-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
A-diagnosticsdiagnostics / error reportingdiagnostics / error reportingBroken WindowBugs / technical debt to be addressed immediatelyBugs / technical debt to be addressed immediatelyC-bugCategory: bugCategory: bug
Description
rust-analyzer version: rust-analyzer 0.3.1839-standalone
rustc version: rustc 1.76.0 (07dca489a 2024-02-04)
relevant settings: Unlikely any are relevant
Bad suggestions: Given this code
fn main() {
let files = [1];
let query = if files.is_empty() {
return;
} else if files.len() == 1 {
1
} else {
17
};
print!("{query}");
}remove-unnecessary-else suggests
fn main() {
let files = [1];
let query = if files.is_empty() {
return;
}
if files.len() == 1 {
1
} else {
17
};
print!("{query}");
}which doesn't compile.
I also get false positives on thread_local!{} macros, but I don't have a minimal reproduction. In my projects it lints on every thread_local!{} call, even those as simple as thread_local!(static SOMETHING: Cell<u32> = Cell::default()); but I don't get the lints in minimal projects.
IndigoLily, zjp-CN, Raekye and dimvoly
Metadata
Metadata
Assignees
Labels
A-diagnosticsdiagnostics / error reportingdiagnostics / error reportingBroken WindowBugs / technical debt to be addressed immediatelyBugs / technical debt to be addressed immediatelyC-bugCategory: bugCategory: bug