mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
140 lines
3.5 KiB
Text
140 lines
3.5 KiB
Text
error: this if-then-else expression will always return true
|
|
--> $DIR/needless_bool.rs:40:5
|
|
|
|
|
40 | / if x {
|
|
41 | | true
|
|
42 | | } else {
|
|
43 | | true
|
|
44 | | };
|
|
| |_____^
|
|
|
|
|
= note: `-D clippy::needless-bool` implied by `-D warnings`
|
|
|
|
error: this if-then-else expression will always return false
|
|
--> $DIR/needless_bool.rs:45:5
|
|
|
|
|
45 | / if x {
|
|
46 | | false
|
|
47 | | } else {
|
|
48 | | false
|
|
49 | | };
|
|
| |_____^
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:50:5
|
|
|
|
|
50 | / if x {
|
|
51 | | true
|
|
52 | | } else {
|
|
53 | | false
|
|
54 | | };
|
|
| |_____^ help: you can reduce it to: `x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:55:5
|
|
|
|
|
55 | / if x {
|
|
56 | | false
|
|
57 | | } else {
|
|
58 | | true
|
|
59 | | };
|
|
| |_____^ help: you can reduce it to: `!x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:60:5
|
|
|
|
|
60 | / if x && y {
|
|
61 | | false
|
|
62 | | } else {
|
|
63 | | true
|
|
64 | | };
|
|
| |_____^ help: you can reduce it to: `!(x && y)`
|
|
|
|
error: this if-then-else expression will always return true
|
|
--> $DIR/needless_bool.rs:83:5
|
|
|
|
|
83 | / if x {
|
|
84 | | return true;
|
|
85 | | } else {
|
|
86 | | return true;
|
|
87 | | };
|
|
| |_____^
|
|
|
|
error: this if-then-else expression will always return false
|
|
--> $DIR/needless_bool.rs:92:5
|
|
|
|
|
92 | / if x {
|
|
93 | | return false;
|
|
94 | | } else {
|
|
95 | | return false;
|
|
96 | | };
|
|
| |_____^
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:101:5
|
|
|
|
|
101 | / if x {
|
|
102 | | return true;
|
|
103 | | } else {
|
|
104 | | return false;
|
|
105 | | };
|
|
| |_____^ help: you can reduce it to: `return x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:110:5
|
|
|
|
|
110 | / if x && y {
|
|
111 | | return true;
|
|
112 | | } else {
|
|
113 | | return false;
|
|
114 | | };
|
|
| |_____^ 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
|
|
|
|
|
119 | / if x {
|
|
120 | | return false;
|
|
121 | | } else {
|
|
122 | | return true;
|
|
123 | | };
|
|
| |_____^ help: you can reduce it to: `return !x`
|
|
|
|
error: this if-then-else expression returns a bool literal
|
|
--> $DIR/needless_bool.rs:128:5
|
|
|
|
|
128 | / if x && y {
|
|
129 | | return false;
|
|
130 | | } else {
|
|
131 | | return true;
|
|
132 | | };
|
|
| |_____^ help: you can reduce it to: `return !(x && y)`
|
|
|
|
error: equality checks against true are unnecessary
|
|
--> $DIR/needless_bool.rs:136:8
|
|
|
|
|
136 | 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:140:8
|
|
|
|
|
140 | if x == false {};
|
|
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
|
|
|
|
error: equality checks against true are unnecessary
|
|
--> $DIR/needless_bool.rs:150:8
|
|
|
|
|
150 | 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
|
|
|
|
|
151 | if x == false {};
|
|
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
|
|
|
|
error: aborting due to 15 previous errors
|
|
|