mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-18 00:53:31 +00:00
96 lines
3.3 KiB
Text
96 lines
3.3 KiB
Text
error: this if-then-else expression will always return true
|
|
--> $DIR/needless_bool.rs:41:5
|
|
|
|
|
41 | if x { true } else { true };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::needless-bool` implied by `-D warnings`
|
|
|
|
error: this if-then-else expression will always return false
|
|
--> $DIR/needless_bool.rs:42:5
|
|
|
|
|
42 | if x { false } else { false };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:43:5
|
|
|
|
|
43 | if x { true } else { false };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:44:5
|
|
|
|
|
44 | if x { false } else { true };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `!x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:45:5
|
|
|
|
|
45 | if x && y { false } else { true };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `!(x && y)`
|
|
|
|
error: this if-then-else expression will always return true
|
|
--> $DIR/needless_bool.rs:60:5
|
|
|
|
|
60 | if x { return true } else { return true };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this if-then-else expression will always return false
|
|
--> $DIR/needless_bool.rs:65:5
|
|
|
|
|
65 | if x { return false } else { return false };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:70:5
|
|
|
|
|
70 | if x { return true } else { return false };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:75:5
|
|
|
|
|
75 | if x && y { return true } else { return false };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x && y`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:80:5
|
|
|
|
|
80 | if x { return false } else { return true };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:85:5
|
|
|
|
|
85 | if x && y { return false } else { return true };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !(x && y)`
|
|
|
|
error: equality checks against true are unnecessary
|
|
--> $DIR/needless_bool.rs:89:7
|
|
|
|
|
89 | if x == true { };
|
|
| ^^^^^^^^^^ help: try simplifying it as shown: `x`
|
|
|
|
|
= note: `-D clippy::bool-comparison` implied by `-D warnings`
|
|
|
|
error: equality checks against false can be replaced by a negation
|
|
--> $DIR/needless_bool.rs:93:7
|
|
|
|
|
93 | if x == false { };
|
|
| ^^^^^^^^^^^ help: try simplifying it as shown: `!x`
|
|
|
|
error: equality checks against true are unnecessary
|
|
--> $DIR/needless_bool.rs:104:8
|
|
|
|
|
104 | if x == true { };
|
|
| ^^^^^^^^^ help: try simplifying it as shown: `x`
|
|
|
|
error: equality checks against false can be replaced by a negation
|
|
--> $DIR/needless_bool.rs:105:8
|
|
|
|
|
105 | if x == false { };
|
|
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
|
|
|
|
error: aborting due to 15 previous errors
|
|
|