| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:31:5 | |
| | | |
| LL | / if x { | |
| LL | | true | |
| LL | | } else { | |
| LL | | false | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `x` | |
| | | |
| = note: `-D clippy::needless-bool` implied by `-D warnings` | |
| = help: to override `-D warnings` add `#[allow(clippy::needless_bool)]` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:37:5 | |
| | | |
| LL | / if x { | |
| LL | | false | |
| LL | | } else { | |
| LL | | true | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `!x` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:43:5 | |
| | | |
| LL | / if x && y { | |
| LL | | false | |
| LL | | } else { | |
| LL | | true | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `!(x && y)` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:52:5 | |
| | | |
| LL | / if a == b { | |
| LL | | false | |
| LL | | } else { | |
| LL | | true | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `a != b` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:58:5 | |
| | | |
| LL | / if a != b { | |
| LL | | false | |
| LL | | } else { | |
| LL | | true | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `a == b` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:64:5 | |
| | | |
| LL | / if a < b { | |
| LL | | false | |
| LL | | } else { | |
| LL | | true | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `a >= b` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:70:5 | |
| | | |
| LL | / if a <= b { | |
| LL | | false | |
| LL | | } else { | |
| LL | | true | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `a > b` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:76:5 | |
| | | |
| LL | / if a > b { | |
| LL | | false | |
| LL | | } else { | |
| LL | | true | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `a <= b` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:82:5 | |
| | | |
| LL | / if a >= b { | |
| LL | | false | |
| LL | | } else { | |
| LL | | true | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `a < b` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:111:5 | |
| | | |
| LL | / if x { | |
| LL | | return true; | |
| LL | | } else { | |
| LL | | return false; | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `return x` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:120:5 | |
| | | |
| LL | / if x { | |
| LL | | return false; | |
| LL | | } else { | |
| LL | | return true; | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `return !x` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:129:5 | |
| | | |
| LL | / if x && y { | |
| LL | | return true; | |
| LL | | } else { | |
| LL | | return false; | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `return x && y` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:138:5 | |
| | | |
| LL | / if x && y { | |
| LL | | return false; | |
| LL | | } else { | |
| LL | | return true; | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `return !(x && y)` | |
| error: equality checks against true are unnecessary | |
| --> tests/ui/needless_bool/fixable.rs:147:8 | |
| | | |
| LL | if x == true {}; | |
| | ^^^^^^^^^ help: try: `x` | |
| | | |
| = note: `-D clippy::bool-comparison` implied by `-D warnings` | |
| = help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]` | |
| error: equality checks against false can be replaced by a negation | |
| --> tests/ui/needless_bool/fixable.rs:152:8 | |
| | | |
| LL | if x == false {}; | |
| | ^^^^^^^^^^ help: try: `!x` | |
| error: equality checks against true are unnecessary | |
| --> tests/ui/needless_bool/fixable.rs:163:8 | |
| | | |
| LL | if x == true {}; | |
| | ^^^^^^^^^ help: try: `x` | |
| error: equality checks against false can be replaced by a negation | |
| --> tests/ui/needless_bool/fixable.rs:165:8 | |
| | | |
| LL | if x == false {}; | |
| | ^^^^^^^^^^ help: try: `!x` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:175:12 | |
| | | |
| LL | } else if returns_bool() { | |
| | ____________^ | |
| LL | | false | |
| LL | | } else { | |
| LL | | true | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `{ !returns_bool() }` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:189:5 | |
| | | |
| LL | / if unsafe { no(4) } & 1 != 0 { | |
| LL | | true | |
| LL | | } else { | |
| LL | | false | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `(unsafe { no(4) } & 1 != 0)` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:195:30 | |
| | | |
| LL | let _brackets_unneeded = if unsafe { no(4) } & 1 != 0 { true } else { false }; | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `unsafe { no(4) } & 1 != 0` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:199:9 | |
| | | |
| LL | if unsafe { no(4) } & 1 != 0 { true } else { false } | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `(unsafe { no(4) } & 1 != 0)` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:211:14 | |
| | | |
| LL | let _x = if a && b { true } else { false }.then(|| todo!()); | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `(a && b)` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:213:14 | |
| | | |
| LL | let _x = if a && b { true } else { false } as u8; | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `(a && b)` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:217:14 | |
| | | |
| LL | let _x = if a { true } else { false }.then(|| todo!()); | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `a` | |
| error: this if-then-else expression returns a bool literal | |
| --> tests/ui/needless_bool/fixable.rs:229:5 | |
| | | |
| LL | / if test_expr!(x) { | |
| LL | | true | |
| LL | | } else { | |
| LL | | false | |
| LL | | }; | |
| | |_____^ help: you can reduce it to: `test_expr!(x)` | |
| error: aborting due to 25 previous errors | |