error: this if-then-else expression will always return true
- --> $DIR/needless_bool.rs:9:5
- |
-9 | if x { true } else { true };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-note: lint level defined here
- --> $DIR/needless_bool.rs:3:9
- |
-3 | #![deny(needless_bool)]
- | ^^^^^^^^^^^^^
+ --> $DIR/needless_bool.rs:40:5
+ |
+LL | / if x {
+LL | | true
+LL | | } else {
+LL | | true
+LL | | };
+ | |_____^
+ |
+ = note: `-D clippy::needless-bool` implied by `-D warnings`
error: this if-then-else expression will always return false
- --> $DIR/needless_bool.rs:10:5
- |
-10 | if x { false } else { false };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ --> $DIR/needless_bool.rs:45:5
+ |
+LL | / if x {
+LL | | false
+LL | | } else {
+LL | | false
+LL | | };
+ | |_____^
error: this if-then-else expression returns a bool literal
- --> $DIR/needless_bool.rs:11:5
- |
-11 | if x { true } else { false };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: you can reduce it to
- | x;
+ --> $DIR/needless_bool.rs:50:5
+ |
+LL | / if x {
+LL | | true
+LL | | } else {
+LL | | false
+LL | | };
+ | |_____^ help: you can reduce it to: `x`
error: this if-then-else expression returns a bool literal
- --> $DIR/needless_bool.rs:15:5
- |
-15 | if x { false } else { true };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: you can reduce it to
- | !x;
+ --> $DIR/needless_bool.rs:55: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
- --> $DIR/needless_bool.rs:19:5
- |
-19 | if x && y { false } else { true };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: you can reduce it to
- | !(x && y);
+ --> $DIR/needless_bool.rs:60: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 will always return true
- --> $DIR/needless_bool.rs:34:5
- |
-34 | if x { return true } else { return true };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ --> $DIR/needless_bool.rs:83:5
+ |
+LL | / if x {
+LL | | return true;
+LL | | } else {
+LL | | return true;
+LL | | };
+ | |_____^
error: this if-then-else expression will always return false
- --> $DIR/needless_bool.rs:40:5
- |
-40 | if x { return false } else { return false };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ --> $DIR/needless_bool.rs:92:5
+ |
+LL | / if x {
+LL | | return false;
+LL | | } else {
+LL | | return false;
+LL | | };
+ | |_____^
error: this if-then-else expression returns a bool literal
- --> $DIR/needless_bool.rs:46:5
- |
-46 | if x { return true } else { return false };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: you can reduce it to
- | return x;
+ --> $DIR/needless_bool.rs:101: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
- --> $DIR/needless_bool.rs:54:5
- |
-54 | if x && y { return true } else { return false };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
-help: you can reduce it to
- | return x && y;
+ --> $DIR/needless_bool.rs:110: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
+ --> $DIR/needless_bool.rs:119: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
- --> $DIR/needless_bool.rs:62:5
+ --> $DIR/needless_bool.rs:128: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
+ --> $DIR/needless_bool.rs:136:8
|
-62 | if x { return false } else { return true };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | if x == true {};
+ | ^^^^^^^^^ help: try simplifying it as shown: `x`
|
-help: you can reduce it to
- | return !x;
+ = note: `-D clippy::bool-comparison` implied by `-D warnings`
-error: this if-then-else expression returns a bool literal
- --> $DIR/needless_bool.rs:70:5
+error: equality checks against false can be replaced by a negation
+ --> $DIR/needless_bool.rs:140:8
|
-70 | if x && y { return false } else { return true };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | if x == false {};
+ | ^^^^^^^^^^ help: try simplifying it as shown: `!x`
+
+error: equality checks against true are unnecessary
+ --> $DIR/needless_bool.rs:150:8
+ |
+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:151:8
|
-help: you can reduce it to
- | return !(x && y);
+LL | if x == false {};
+ | ^^^^^^^^^^ help: try simplifying it as shown: `!x`
-error: aborting due to 11 previous errors
+error: aborting due to 15 previous errors