#![warn(clippy::all)] #![warn(clippy::if_not_else)] fn foo() -> bool { unimplemented!() } fn bla() -> bool { unimplemented!() } fn main() { if bla() { println!("Bunny"); } else { //~^ if_not_else println!("Bugs"); } if 4 == 5 { println!("Bunny"); } else { //~^ if_not_else println!("Bugs"); } if !foo() { println!("Foo"); } else if !bla() { println!("Bugs"); } else { println!("Bunny"); } if (foo() && bla()) { println!("both true"); } else { //~^ if_not_else #[cfg(not(debug_assertions))] println!("not debug"); #[cfg(debug_assertions)] println!("debug"); if foo() { println!("foo"); } else if bla() { println!("bla"); } else { println!("both false"); } } } fn with_comments() { if foo() { println!("foo"); /* foo */ } else { //~^ if_not_else /* foo is false */ println!("foo is false"); } if bla() { println!("bla"); // bla } else { //~^ if_not_else // bla is false println!("bla"); } } fn with_annotations() { #[cfg(debug_assertions)] if foo() { println!("foo"); /* foo */ } else { //~^ if_not_else /* foo is false */ println!("foo is false"); } }