rust-clippy/tests/ui/needless_bool.stderr

152 lines
3.8 KiB
Text
Raw Normal View History

error: this if-then-else expression will always return true
--> $DIR/needless_bool.rs:31:5
2018-10-06 16:18:06 +00:00
|
2018-12-27 15:57:55 +00:00
LL | / if x {
LL | | true
LL | | } else {
LL | | true
LL | | };
2018-12-10 05:27:19 +00:00
| |_____^
2018-10-06 16:18:06 +00:00
|
= note: `-D clippy::needless-bool` implied by `-D warnings`
error: this if-then-else expression will always return false
--> $DIR/needless_bool.rs:36:5
|
2018-12-27 15:57:55 +00:00
LL | / if x {
LL | | false
LL | | } else {
LL | | false
LL | | };
2018-12-10 05:27:19 +00:00
| |_____^
error: this if-then-else expression returns a bool literal
--> $DIR/needless_bool.rs:41:5
|
2018-12-27 15:57:55 +00:00
LL | / if x {
LL | | true
LL | | } else {
LL | | false
LL | | };
2018-12-10 05:27:19 +00:00
| |_____^ help: you can reduce it to: `x`
error: this if-then-else expression returns a bool literal
--> $DIR/needless_bool.rs:46:5
|
2018-12-27 15:57:55 +00:00
LL | / if x {
LL | | false
LL | | } else {
LL | | true
LL | | };
2018-12-10 05:27:19 +00:00
| |_____^ help: you can reduce it to: `!x`
error: this if-then-else expression returns a bool literal
--> $DIR/needless_bool.rs:51:5
|
2018-12-27 15:57:55 +00:00
LL | / if x && y {
LL | | false
LL | | } else {
LL | | true
LL | | };
2018-12-10 05:27:19 +00:00
| |_____^ help: you can reduce it to: `!(x && y)`
error: this if-then-else expression will always return true
--> $DIR/needless_bool.rs:74:5
|
2018-12-27 15:57:55 +00:00
LL | / if x {
LL | | return true;
LL | | } else {
LL | | return true;
LL | | };
2018-12-10 05:27:19 +00:00
| |_____^
error: this if-then-else expression will always return false
--> $DIR/needless_bool.rs:83:5
|
2018-12-27 15:57:55 +00:00
LL | / if x {
LL | | return false;
LL | | } else {
LL | | return false;
LL | | };
2018-12-10 05:27:19 +00:00
| |_____^
error: this if-then-else expression returns a bool literal
--> $DIR/needless_bool.rs:92:5
2018-12-27 15:57:55 +00:00
|
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
--> $DIR/needless_bool.rs:101:5
2018-12-27 15:57:55 +00:00
|
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
--> $DIR/needless_bool.rs:110:5
2018-12-27 15:57:55 +00:00
|
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
--> $DIR/needless_bool.rs:119:5
2018-12-27 15:57:55 +00:00
|
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
--> $DIR/needless_bool.rs:127:8
2018-12-27 15:57:55 +00:00
|
LL | 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:131:8
2018-12-27 15:57:55 +00:00
|
LL | if x == false {};
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
error: equality checks against true are unnecessary
--> $DIR/needless_bool.rs:141:8
2018-12-27 15:57:55 +00:00
|
LL | 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:142:8
2018-12-27 15:57:55 +00:00
|
LL | if x == false {};
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
error: this if-then-else expression returns a bool literal
--> $DIR/needless_bool.rs:151:12
|
LL | } else if returns_bool() {
| ____________^
LL | | false
LL | | } else {
LL | | true
LL | | };
| |_____^ help: you can reduce it to: `!returns_bool()`
error: aborting due to 16 previous errors
2018-01-16 16:06:27 +00:00