rust-clippy/tests/ui/needless_bool.stderr

141 lines
3.5 KiB
Text
Raw Normal View History

error: this if-then-else expression will always return true
2018-12-10 05:27:19 +00:00
--> $DIR/needless_bool.rs:40:5
2018-10-06 16:18:06 +00:00
|
2018-12-10 05:27:19 +00:00
40 | / if x {
41 | | true
42 | | } else {
43 | | true
44 | | };
| |_____^
2018-10-06 16:18:06 +00:00
|
= note: `-D clippy::needless-bool` implied by `-D warnings`
error: this if-then-else expression will always return false
2018-12-10 05:27:19 +00:00
--> $DIR/needless_bool.rs:45:5
|
2018-12-10 05:27:19 +00:00
45 | / if x {
46 | | false
47 | | } else {
48 | | false
49 | | };
| |_____^
error: this if-then-else expression returns a bool literal
2018-12-10 05:27:19 +00:00
--> $DIR/needless_bool.rs:50:5
|
2018-12-10 05:27:19 +00:00
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
2018-12-10 05:27:19 +00:00
--> $DIR/needless_bool.rs:55:5
|
2018-12-10 05:27:19 +00:00
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
2018-12-10 05:27:19 +00:00
--> $DIR/needless_bool.rs:60:5
|
2018-12-10 05:27:19 +00:00
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
2018-12-10 05:27:19 +00:00
--> $DIR/needless_bool.rs:83:5
|
2018-12-10 05:27:19 +00:00
83 | / if x {
84 | | return true;
85 | | } else {
86 | | return true;
87 | | };
| |_____^
error: this if-then-else expression will always return false
2018-12-10 05:27:19 +00:00
--> $DIR/needless_bool.rs:92:5
|
2018-12-10 05:27:19 +00:00
92 | / if x {
93 | | return false;
94 | | } else {
95 | | return false;
96 | | };
| |_____^
error: this if-then-else expression returns a bool literal
2018-12-10 05:27:19 +00:00
--> $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
2018-12-10 05:27:19 +00:00
--> $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
2018-12-10 05:27:19 +00:00
--> $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
2018-12-10 05:27:19 +00:00
--> $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
2018-12-10 05:27:19 +00:00
--> $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
2018-12-10 05:27:19 +00:00
--> $DIR/needless_bool.rs:140:8
|
140 | if x == false {};
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
error: equality checks against true are unnecessary
2018-12-10 05:27:19 +00:00
--> $DIR/needless_bool.rs:150:8
|
2018-12-10 05:27:19 +00:00
150 | if x == true {};
| ^^^^^^^^^ help: try simplifying it as shown: `x`
error: equality checks against false can be replaced by a negation
2018-12-10 05:27:19 +00:00
--> $DIR/needless_bool.rs:151:8
|
2018-12-10 05:27:19 +00:00
151 | if x == false {};
| ^^^^^^^^^^ help: try simplifying it as shown: `!x`
error: aborting due to 15 previous errors
2018-01-16 16:06:27 +00:00