-
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-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when applied
Description
Summary
Broken code after applying automatic fix
Reproducer
I tried this code:
fn main() {
let n = if false {
None
} else if let Ok(n) = "1".parse::<u8>() {
Some(n)
} else {
None
};
}
with --fix
I expected to see this happen:
fn main() {
let n = if false {
None
} else {
"1".parse::<u8>().ok()
};
}
Instead, this happened:
fn main() {
let n = if false {
None
} else "1".parse::<u8>().ok();
}
Version
rustc 1.86.0-nightly (9cd60bd2c 2025-02-15)
binary: rustc
commit-hash: 9cd60bd2ccc41bc898d2ad86728f14035d2df72d
commit-date: 2025-02-15
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.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-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when applied