-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't
Description
fn main() {
println!("{:?}", func(4));
}
fn func(n: i32) -> bool {
if n < 2 {
return true;
} else if n > 2 {
return false;
}
return false; // return outside of conditions
}
this code is basically identical to
fn main() {
println!("{:?}", func(4));
}
fn func(n: i32) -> bool {
if n < 2 {
return true;
} else if n > 2 {
return false;
} else { // return moved into else {}
return false;
}
}
but only the latter triggers the if_same_then_else
warning.
Should the first example trigger a warning as well?
kevincox
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tIssue: The lint should have been triggered on code, but wasn't