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;
46 }; // would also be questionable, but we don't catch this yet
56 fn bool_ret3(x: bool) -> bool {
60 fn bool_ret4(x: bool) -> bool {
64 fn bool_ret5(x: bool, y: bool) -> bool {
68 fn bool_ret6(x: bool, y: bool) -> bool {
72 fn needless_bool(x: bool) {
76 fn needless_bool2(x: bool) {
80 fn needless_bool3(x: bool) {
81 bool_comparison_trigger! {
82 test_one: false, false;
83 test_three: false, false;
91 fn needless_bool_in_the_suggestion_wraps_the_predicate_of_if_else_statement_in_brackets() {
93 let returns_bool = || false;
97 } else { !returns_bool() };