mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-30 16:39:26 +00:00
4cfb0966a1
Closes #4334
151 lines
3.8 KiB
Text
151 lines
3.8 KiB
Text
error: this if-then-else expression will always return true
|
|
--> $DIR/needless_bool.rs:32: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:37: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:42: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:47: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:52: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:75: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:84: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:93: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:102: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:111: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:120: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:128: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/needless_bool.rs:132:8
|
|
|
|
|
LL | if x == false {};
|
|
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
|
|
|
|
error: equality checks against true are unnecessary
|
|
--> $DIR/needless_bool.rs:142: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:143:8
|
|
|
|
|
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:152: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
|
|
|