mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-16 18:44:56 +00:00
112 lines
2.9 KiB
Plaintext
112 lines
2.9 KiB
Plaintext
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:41:5
|
|
|
|
|
LL | / if x {
|
|
LL | | true
|
|
LL | | } else {
|
|
LL | | false
|
|
LL | | };
|
|
| |_____^ 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
|
|
|
|
|
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/fixable.rs:51: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 returns a bool literal
|
|
--> $DIR/fixable.rs:71: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/fixable.rs:79: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/fixable.rs:87: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/fixable.rs:95: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/fixable.rs:103:8
|
|
|
|
|
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:107:8
|
|
|
|
|
LL | if x == false {};
|
|
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
|
|
|
|
error: equality checks against true are unnecessary
|
|
--> $DIR/fixable.rs:117:8
|
|
|
|
|
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:118:8
|
|
|
|
|
LL | if x == false {};
|
|
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/fixable.rs:127: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 12 previous errors
|
|
|