-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Summary
It might just be me but this clippy lint feels wrong.
Lint Name
clippy::collapsible_if
Reproducer
POC
let x: Result<(), ()> = Err(());
if 1 > 2 {
if let Err(_err) = x {}
}
// Clippy suggests
match 1 > 2 {
true => if let Err(_err) = x {}
false => (),
}
Now that if-let-chains are stabilized, it should suggest something like this:
if 1 > 2 && let Err(_err) = x {}
IMO For older rust versions, it souldn't suggest anything if one of the if statements is a if let
.
Version
rustc 1.89.0 (29483883e 2025-08-04)
binary: rustc
commit-hash: 29483883eed69d5fb4db01964cdf2af4d86e9cb2
commit-date: 2025-08-04
host: x86_64-unknown-linux-gnu
release: 1.89.0
LLVM version: 20.1.7
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have