rust-clippy/tests/ui/needless_bool/fixable.stderr

194 lines
5.1 KiB
Text
Raw Normal View History

error: this if-then-else expression returns a bool literal
--> $DIR/fixable.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`
|
= note: `-D clippy::needless-bool` implied by `-D warnings`
error: this if-then-else expression returns a bool literal
--> $DIR/fixable.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/fixable.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 returns a bool literal
--> $DIR/fixable.rs:59:5
|
LL | / if a == b {
LL | | false
LL | | } else {
LL | | true
LL | | };
| |_____^ help: you can reduce it to: `a != b`
error: this if-then-else expression returns a bool literal
--> $DIR/fixable.rs:64:5
|
LL | / if a != b {
LL | | false
LL | | } else {
LL | | true
LL | | };
| |_____^ help: you can reduce it to: `a == b`
error: this if-then-else expression returns a bool literal
--> $DIR/fixable.rs:69:5
|
LL | / if a < b {
LL | | false
LL | | } else {
LL | | true
LL | | };
| |_____^ help: you can reduce it to: `a >= b`
error: this if-then-else expression returns a bool literal
--> $DIR/fixable.rs:74:5
|
LL | / if a <= b {
LL | | false
LL | | } else {
LL | | true
LL | | };
| |_____^ help: you can reduce it to: `a > b`
error: this if-then-else expression returns a bool literal
--> $DIR/fixable.rs:79:5
|
LL | / if a > b {
LL | | false
LL | | } else {
LL | | true
LL | | };
| |_____^ help: you can reduce it to: `a <= b`
error: this if-then-else expression returns a bool literal
--> $DIR/fixable.rs:84:5
|
LL | / if a >= b {
LL | | false
LL | | } else {
LL | | true
LL | | };
| |_____^ help: you can reduce it to: `a < b`
error: this if-then-else expression returns a bool literal
--> $DIR/fixable.rs:105: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/fixable.rs:113:5
2018-12-27 15:57:55 +00:00
|
LL | / if x {
LL | | return false;
LL | | } else {
LL | | return true;
2018-12-27 15:57:55 +00:00
LL | | };
| |_____^ help: you can reduce it to: `return !x`
error: this if-then-else expression returns a bool literal
--> $DIR/fixable.rs:121: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/fixable.rs:129: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/fixable.rs:137: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/fixable.rs:141: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/fixable.rs:151: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/fixable.rs:152: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/fixable.rs:161:12
|
LL | } else if returns_bool() {
| ____________^
LL | | false
LL | | } else {
LL | | true
LL | | };
| |_____^ help: you can reduce it to: `{ !returns_bool() }`
error: this if-then-else expression returns a bool literal
--> $DIR/fixable.rs:174:5
|
LL | / if unsafe { no(4) } & 1 != 0 {
LL | | true
LL | | } else {
LL | | false
LL | | };
| |_____^ help: you can reduce it to: `(unsafe { no(4) } & 1 != 0)`
error: this if-then-else expression returns a bool literal
--> $DIR/fixable.rs:179:30
|
LL | let _brackets_unneeded = if unsafe { no(4) } & 1 != 0 { true } else { false };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `unsafe { no(4) } & 1 != 0`
error: this if-then-else expression returns a bool literal
--> $DIR/fixable.rs:182:9
|
LL | if unsafe { no(4) } & 1 != 0 { true } else { false }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `(unsafe { no(4) } & 1 != 0)`
error: aborting due to 21 previous errors
2018-01-16 16:06:27 +00:00