1 #![warn(clippy::same_functions_in_if_condition)]
2 #![allow(clippy::ifs_same_cond)] // This warning is different from `ifs_same_cond`.
3 #![allow(clippy::if_same_then_else, clippy::comparison_chain)] // all empty blocks
5 fn function() -> bool {
9 fn fn_arg(_arg: u8) -> bool {
16 fn method(&self) -> bool {
19 fn method_arg(&self, _arg: u8) -> bool {
24 fn ifs_same_cond_fn() {
29 } else if function() {
30 //~ ERROR ifs same condition
35 //~ ERROR ifs same condition
39 } else if obj.method() {
40 //~ ERROR ifs same condition
43 if obj.method_arg(a) {
44 } else if obj.method_arg(a) {
45 //~ ERROR ifs same condition
50 //~ ERROR ifs same condition
51 } else if v.pop() == None {
55 //~ ERROR ifs same condition
56 } else if v.len() == 42 {
60 // ok, different conditions
61 } else if v.len() == 2 {
65 // ok, different arguments.
69 if obj.method_arg(0) {
70 // ok, different arguments.
71 } else if obj.method_arg(1) {
75 // ok, warning is on `ifs_same_cond` behalf.
81 // macro as condition (see #6168)
82 let os = if cfg!(target_os = "macos") {
84 } else if cfg!(target_os = "windows") {