3 #![warn(clippy::needless_bool)]
8 clippy::if_same_then_else,
9 clippy::needless_return
14 macro_rules! bool_comparison_trigger {
15 ($($i:ident: $def:expr, $stb:expr );+ $(;)*) => (
19 $($i: (Cell<bool>, bool, bool)),+
24 pub fn trigger(&self, key: &str) -> bool {
26 if let stringify!($i) = key {
27 return self.$i.1 && self.$i.2 == $def;
58 }; // would also be questionable, but we don't catch this yet
68 fn bool_ret3(x: bool) -> bool {
76 fn bool_ret4(x: bool) -> bool {
84 fn bool_ret5(x: bool, y: bool) -> bool {
92 fn bool_ret6(x: bool, y: bool) -> bool {
100 fn needless_bool(x: bool) {
104 fn needless_bool2(x: bool) {
108 fn needless_bool3(x: bool) {
109 bool_comparison_trigger! {
110 test_one: false, false;
111 test_three: false, false;
112 test_two: true, true;
119 fn needless_bool_in_the_suggestion_wraps_the_predicate_of_if_else_statement_in_brackets() {
121 let returns_bool = || false;
125 } else if returns_bool() {