rust-lang / rust-lang/rust-clippy
`collapsible_match` FN on if let chain
Open
Nobody has claimed this yet.
C-bug
I-false-negative
- Dominant language
- Rust
- Stars
- 13.5k
- Forks
- 2.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 32
Description
Summary
collapsible_match FN on if let chain
Lint Name
collapsible_match
Reproducer
I tried this code:
let opt = Some(Some(1));
let _ = if true && let Some(inner) = opt {
match inner {
Some(_) => 0,
_ => 1,
}
} else {
1
};
I expected to see this happen:
Lint on the if let chain
Instead, this happened:
Nothing
Version
rustc 1.95.0-nightly (9e79395f9 2026-02-10)
binary: rustc
commit-hash: 9e79395f92bff6a8f536430e42a4beae69f60ff8
commit-date: 2026-02-10
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the collapsible_match lint and its existing test coverage, then reproduce the reported Rust example to trace why the if-let chain is skipped. Update the lint behavior so this case is detected and add coverage demonstrating the expected diagnostic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100