fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
5.3 KiB195 linesraw
1error: this if-then-else expression returns a bool literal
2  --> $DIR/fixable.rs:40:5
3   |
4LL | /     if x {
5LL | |         true
6LL | |     } else {
7LL | |         false
8LL | |     };
9   | |_____^ help: you can reduce it to: `x`
10   |
11   = note: `-D clippy::needless-bool` implied by `-D warnings`
12   = help: to override `-D warnings` add `#[allow(clippy::needless_bool)]`
13
14error: this if-then-else expression returns a bool literal
15  --> $DIR/fixable.rs:45:5
16   |
17LL | /     if x {
18LL | |         false
19LL | |     } else {
20LL | |         true
21LL | |     };
22   | |_____^ help: you can reduce it to: `!x`
23
24error: this if-then-else expression returns a bool literal
25  --> $DIR/fixable.rs:50:5
26   |
27LL | /     if x && y {
28LL | |         false
29LL | |     } else {
30LL | |         true
31LL | |     };
32   | |_____^ help: you can reduce it to: `!(x && y)`
33
34error: this if-then-else expression returns a bool literal
35  --> $DIR/fixable.rs:58:5
36   |
37LL | /     if a == b {
38LL | |         false
39LL | |     } else {
40LL | |         true
41LL | |     };
42   | |_____^ help: you can reduce it to: `a != b`
43
44error: this if-then-else expression returns a bool literal
45  --> $DIR/fixable.rs:63:5
46   |
47LL | /     if a != b {
48LL | |         false
49LL | |     } else {
50LL | |         true
51LL | |     };
52   | |_____^ help: you can reduce it to: `a == b`
53
54error: this if-then-else expression returns a bool literal
55  --> $DIR/fixable.rs:68:5
56   |
57LL | /     if a < b {
58LL | |         false
59LL | |     } else {
60LL | |         true
61LL | |     };
62   | |_____^ help: you can reduce it to: `a >= b`
63
64error: this if-then-else expression returns a bool literal
65  --> $DIR/fixable.rs:73:5
66   |
67LL | /     if a <= b {
68LL | |         false
69LL | |     } else {
70LL | |         true
71LL | |     };
72   | |_____^ help: you can reduce it to: `a > b`
73
74error: this if-then-else expression returns a bool literal
75  --> $DIR/fixable.rs:78:5
76   |
77LL | /     if a > b {
78LL | |         false
79LL | |     } else {
80LL | |         true
81LL | |     };
82   | |_____^ help: you can reduce it to: `a <= b`
83
84error: this if-then-else expression returns a bool literal
85  --> $DIR/fixable.rs:83:5
86   |
87LL | /     if a >= b {
88LL | |         false
89LL | |     } else {
90LL | |         true
91LL | |     };
92   | |_____^ help: you can reduce it to: `a < b`
93
94error: this if-then-else expression returns a bool literal
95  --> $DIR/fixable.rs:111:5
96   |
97LL | /     if x {
98LL | |         return true;
99LL | |     } else {
100LL | |         return false;
101LL | |     };
102   | |_____^ help: you can reduce it to: `return x`
103
104error: this if-then-else expression returns a bool literal
105  --> $DIR/fixable.rs:119:5
106   |
107LL | /     if x {
108LL | |         return false;
109LL | |     } else {
110LL | |         return true;
111LL | |     };
112   | |_____^ help: you can reduce it to: `return !x`
113
114error: this if-then-else expression returns a bool literal
115  --> $DIR/fixable.rs:127:5
116   |
117LL | /     if x && y {
118LL | |         return true;
119LL | |     } else {
120LL | |         return false;
121LL | |     };
122   | |_____^ help: you can reduce it to: `return x && y`
123
124error: this if-then-else expression returns a bool literal
125  --> $DIR/fixable.rs:135:5
126   |
127LL | /     if x && y {
128LL | |         return false;
129LL | |     } else {
130LL | |         return true;
131LL | |     };
132   | |_____^ help: you can reduce it to: `return !(x && y)`
133
134error: equality checks against true are unnecessary
135  --> $DIR/fixable.rs:143:8
136   |
137LL |     if x == true {};
138   |        ^^^^^^^^^ help: try simplifying it as shown: `x`
139   |
140   = note: `-D clippy::bool-comparison` implied by `-D warnings`
141   = help: to override `-D warnings` add `#[allow(clippy::bool_comparison)]`
142
143error: equality checks against false can be replaced by a negation
144  --> $DIR/fixable.rs:147:8
145   |
146LL |     if x == false {};
147   |        ^^^^^^^^^^ help: try simplifying it as shown: `!x`
148
149error: equality checks against true are unnecessary
150  --> $DIR/fixable.rs:157:8
151   |
152LL |     if x == true {};
153   |        ^^^^^^^^^ help: try simplifying it as shown: `x`
154
155error: equality checks against false can be replaced by a negation
156  --> $DIR/fixable.rs:158:8
157   |
158LL |     if x == false {};
159   |        ^^^^^^^^^^ help: try simplifying it as shown: `!x`
160
161error: this if-then-else expression returns a bool literal
162  --> $DIR/fixable.rs:167:12
163   |
164LL |       } else if returns_bool() {
165   |  ____________^
166LL | |         false
167LL | |     } else {
168LL | |         true
169LL | |     };
170   | |_____^ help: you can reduce it to: `{ !returns_bool() }`
171
172error: this if-then-else expression returns a bool literal
173  --> $DIR/fixable.rs:180:5
174   |
175LL | /     if unsafe { no(4) } & 1 != 0 {
176LL | |         true
177LL | |     } else {
178LL | |         false
179LL | |     };
180   | |_____^ help: you can reduce it to: `(unsafe { no(4) } & 1 != 0)`
181
182error: this if-then-else expression returns a bool literal
183  --> $DIR/fixable.rs:185:30
184   |
185LL |     let _brackets_unneeded = if unsafe { no(4) } & 1 != 0 { true } else { false };
186   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `unsafe { no(4) } & 1 != 0`
187
188error: this if-then-else expression returns a bool literal
189  --> $DIR/fixable.rs:188:9
190   |
191LL |         if unsafe { no(4) } & 1 != 0 { true } else { false }
192   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `(unsafe { no(4) } & 1 != 0)`
193
194error: aborting due to 21 previous errors
195