mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
70 lines
2.5 KiB
Text
70 lines
2.5 KiB
Text
error: this if-then-else expression will always return true
|
|
--> $DIR/needless_bool.rs:19:5
|
|
|
|
|
19 | 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:20:5
|
|
|
|
|
20 | if x { false } else { false };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:21:5
|
|
|
|
|
21 | 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:22:5
|
|
|
|
|
22 | 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:23:5
|
|
|
|
|
23 | 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:35:5
|
|
|
|
|
35 | if x { return true } else { return true };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this if-then-else expression will always return false
|
|
--> $DIR/needless_bool.rs:40:5
|
|
|
|
|
40 | if x { return false } else { return false };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:45:5
|
|
|
|
|
45 | 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:50:5
|
|
|
|
|
50 | 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:55:5
|
|
|
|
|
55 | 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:60:5
|
|
|
|
|
60 | if x && y { return false } else { return true };
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !(x && y)`
|
|
|
|
error: aborting due to 11 previous errors
|
|
|