Open
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?