rust/tests/ui/needless_bool.stderr

71 lines
2.5 KiB
Plaintext
Raw Normal View History

error: this if-then-else expression will always return true
2018-10-06 18:18:06 +02:00
--> $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
2018-10-06 18:18:06 +02:00
--> $DIR/needless_bool.rs:20:5
|
2018-10-06 18:18:06 +02:00
20 | if x { false } else { false };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this if-then-else expression returns a bool literal
2018-10-06 18:18:06 +02:00
--> $DIR/needless_bool.rs:21:5
|
2018-10-06 18:18:06 +02:00
21 | if x { true } else { false };
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `x`
error: this if-then-else expression returns a bool literal
2018-10-06 18:18:06 +02:00
--> $DIR/needless_bool.rs:22:5
|
2018-10-06 18:18:06 +02:00
22 | if x { false } else { true };
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `!x`
error: this if-then-else expression returns a bool literal
2018-10-06 18:18:06 +02:00
--> $DIR/needless_bool.rs:23:5
|
2018-10-06 18:18:06 +02:00
23 | if x && y { false } else { true };
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `!(x && y)`
error: this if-then-else expression will always return true
2018-10-06 18:18:06 +02:00
--> $DIR/needless_bool.rs:35:5
|
2018-10-06 18:18:06 +02:00
35 | if x { return true } else { return true };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this if-then-else expression will always return false
2018-10-06 18:18:06 +02:00
--> $DIR/needless_bool.rs:40:5
|
2018-10-06 18:18:06 +02:00
40 | if x { return false } else { return false };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: this if-then-else expression returns a bool literal
2018-10-06 18:18:06 +02:00
--> $DIR/needless_bool.rs:45:5
|
2018-10-06 18:18:06 +02:00
45 | if x { return true } else { return false };
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x`
error: this if-then-else expression returns a bool literal
2018-10-06 18:18:06 +02:00
--> $DIR/needless_bool.rs:50:5
|
2018-10-06 18:18:06 +02:00
50 | if x && y { return true } else { return false };
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return x && y`
error: this if-then-else expression returns a bool literal
2018-10-06 18:18:06 +02:00
--> $DIR/needless_bool.rs:55:5
|
2018-10-06 18:18:06 +02:00
55 | if x { return false } else { return true };
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !x`
error: this if-then-else expression returns a bool literal
2018-10-06 18:18:06 +02:00
--> $DIR/needless_bool.rs:60:5
|
2018-10-06 18:18:06 +02:00
60 | if x && y { return false } else { return true };
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `return !(x && y)`
2018-01-16 17:06:27 +01:00
error: aborting due to 11 previous errors