mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +00:00
2f327aaba5
1. Convert IfNotElse to LateLintPass and use clippy_utils::is_else_clause for checking. 2. Handle the case where the span comes from desugaring. 3. Update tests.
29 lines
464 B
Rust
29 lines
464 B
Rust
#![warn(clippy::all)]
|
|
#![warn(clippy::if_not_else)]
|
|
|
|
fn foo() -> bool {
|
|
unimplemented!()
|
|
}
|
|
fn bla() -> bool {
|
|
unimplemented!()
|
|
}
|
|
|
|
fn main() {
|
|
if !bla() {
|
|
println!("Bugs");
|
|
} else {
|
|
println!("Bunny");
|
|
}
|
|
if 4 != 5 {
|
|
println!("Bugs");
|
|
} else {
|
|
println!("Bunny");
|
|
}
|
|
if !foo() {
|
|
println!("Foo");
|
|
} else if !bla() {
|
|
println!("Bugs");
|
|
} else {
|
|
println!("Bunny");
|
|
}
|
|
}
|