fork/rust

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

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

master
8.9 KiB230 linesraw
1error: boolean expression will never evaluate to 'true'
2  --> $DIR/const_comparisons.rs:45:5
3   |
4LL |     status_code <= 400 && status_code > 500;
5   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6   |
7   = note: since `400` < `500`, the expression evaluates to false for any value of `status_code`
8   = note: `-D clippy::impossible-comparisons` implied by `-D warnings`
9   = help: to override `-D warnings` add `#[allow(clippy::impossible_comparisons)]`
10
11error: boolean expression will never evaluate to 'true'
12  --> $DIR/const_comparisons.rs:48:5
13   |
14LL |     status_code > 500 && status_code < 400;
15   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16   |
17   = note: since `500` > `400`, the expression evaluates to false for any value of `status_code`
18
19error: boolean expression will never evaluate to 'true'
20  --> $DIR/const_comparisons.rs:51:5
21   |
22LL |     status_code < 500 && status_code > 500;
23   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24   |
25   = note: `status_code` cannot simultaneously be greater than and less than `500`
26
27error: boolean expression will never evaluate to 'true'
28  --> $DIR/const_comparisons.rs:56:5
29   |
30LL |     status_code < { 400 } && status_code > { 500 };
31   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32   |
33   = note: since `{ 400 }` < `{ 500 }`, the expression evaluates to false for any value of `status_code`
34
35error: boolean expression will never evaluate to 'true'
36  --> $DIR/const_comparisons.rs:59:5
37   |
38LL |     status_code < STATUS_BAD_REQUEST && status_code > STATUS_SERVER_ERROR;
39   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40   |
41   = note: since `STATUS_BAD_REQUEST` < `STATUS_SERVER_ERROR`, the expression evaluates to false for any value of `status_code`
42
43error: boolean expression will never evaluate to 'true'
44  --> $DIR/const_comparisons.rs:62:5
45   |
46LL |     status_code <= u16::MIN + 1 && status_code > STATUS_SERVER_ERROR;
47   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48   |
49   = note: since `u16::MIN + 1` < `STATUS_SERVER_ERROR`, the expression evaluates to false for any value of `status_code`
50
51error: boolean expression will never evaluate to 'true'
52  --> $DIR/const_comparisons.rs:65:5
53   |
54LL |     status_code < STATUS_SERVER_ERROR && status_code > STATUS_SERVER_ERROR;
55   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56   |
57   = note: `status_code` cannot simultaneously be greater than and less than `STATUS_SERVER_ERROR`
58
59error: boolean expression will never evaluate to 'true'
60  --> $DIR/const_comparisons.rs:70:5
61   |
62LL |     status < { 400 } && status > { 500 };
63   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64   |
65   = note: since `{ 400 }` < `{ 500 }`, the expression evaluates to false for any value of `status`
66
67error: boolean expression will never evaluate to 'true'
68  --> $DIR/const_comparisons.rs:73:5
69   |
70LL |     status < STATUS_BAD_REQUEST && status > STATUS_SERVER_ERROR;
71   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
72   |
73   = note: since `STATUS_BAD_REQUEST` < `STATUS_SERVER_ERROR`, the expression evaluates to false for any value of `status`
74
75error: boolean expression will never evaluate to 'true'
76  --> $DIR/const_comparisons.rs:76:5
77   |
78LL |     status <= u16::MIN + 1 && status > STATUS_SERVER_ERROR;
79   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
80   |
81   = note: since `u16::MIN + 1` < `STATUS_SERVER_ERROR`, the expression evaluates to false for any value of `status`
82
83error: boolean expression will never evaluate to 'true'
84  --> $DIR/const_comparisons.rs:79:5
85   |
86LL |     status < STATUS_SERVER_ERROR && status > STATUS_SERVER_ERROR;
87   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
88   |
89   = note: `status` cannot simultaneously be greater than and less than `STATUS_SERVER_ERROR`
90
91error: boolean expression will never evaluate to 'true'
92  --> $DIR/const_comparisons.rs:89:5
93   |
94LL |     500 >= status_code && 600 < status_code;
95   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
96   |
97   = note: since `500` < `600`, the expression evaluates to false for any value of `status_code`
98
99error: boolean expression will never evaluate to 'true'
100  --> $DIR/const_comparisons.rs:93:5
101   |
102LL |     500 >= status_code && status_code > 600;
103   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104   |
105   = note: since `500` < `600`, the expression evaluates to false for any value of `status_code`
106
107error: boolean expression will never evaluate to 'true'
108  --> $DIR/const_comparisons.rs:103:5
109   |
110LL |     500 >= status && 600 < status;
111   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
112   |
113   = note: since `500` < `600`, the expression evaluates to false for any value of `status`
114
115error: boolean expression will never evaluate to 'true'
116  --> $DIR/const_comparisons.rs:107:5
117   |
118LL |     500 >= status && status > 600;
119   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
120   |
121   = note: since `500` < `600`, the expression evaluates to false for any value of `status`
122
123error: right-hand side of `&&` operator has no effect
124  --> $DIR/const_comparisons.rs:112:5
125   |
126LL |     status_code < 200 && status_code <= 299;
127   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
128   |
129note: `if `status_code < 200` evaluates to true, status_code <= 299` will always evaluate to true as well
130  --> $DIR/const_comparisons.rs:112:23
131   |
132LL |     status_code < 200 && status_code <= 299;
133   |                       ^^^^^^^^^^^^^^^^^^^^^
134   = note: `-D clippy::redundant-comparisons` implied by `-D warnings`
135   = help: to override `-D warnings` add `#[allow(clippy::redundant_comparisons)]`
136
137error: left-hand side of `&&` operator has no effect
138  --> $DIR/const_comparisons.rs:114:5
139   |
140LL |     status_code > 200 && status_code >= 299;
141   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
142   |
143note: `if `status_code >= 299` evaluates to true, status_code > 200` will always evaluate to true as well
144  --> $DIR/const_comparisons.rs:114:5
145   |
146LL |     status_code > 200 && status_code >= 299;
147   |     ^^^^^^^^^^^^^^^^^^^^^
148
149error: left-hand side of `&&` operator has no effect
150  --> $DIR/const_comparisons.rs:118:5
151   |
152LL |     status_code >= 500 && status_code > 500;
153   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154   |
155note: `if `status_code > 500` evaluates to true, status_code >= 500` will always evaluate to true as well
156  --> $DIR/const_comparisons.rs:118:5
157   |
158LL |     status_code >= 500 && status_code > 500;
159   |     ^^^^^^^^^^^^^^^^^^^^^^
160
161error: right-hand side of `&&` operator has no effect
162  --> $DIR/const_comparisons.rs:121:5
163   |
164LL |     status_code > 500 && status_code >= 500;
165   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
166   |
167note: `if `status_code > 500` evaluates to true, status_code >= 500` will always evaluate to true as well
168  --> $DIR/const_comparisons.rs:121:23
169   |
170LL |     status_code > 500 && status_code >= 500;
171   |                       ^^^^^^^^^^^^^^^^^^^^^
172
173error: left-hand side of `&&` operator has no effect
174  --> $DIR/const_comparisons.rs:124:5
175   |
176LL |     status_code <= 500 && status_code < 500;
177   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
178   |
179note: `if `status_code < 500` evaluates to true, status_code <= 500` will always evaluate to true as well
180  --> $DIR/const_comparisons.rs:124:5
181   |
182LL |     status_code <= 500 && status_code < 500;
183   |     ^^^^^^^^^^^^^^^^^^^^^^
184
185error: right-hand side of `&&` operator has no effect
186  --> $DIR/const_comparisons.rs:127:5
187   |
188LL |     status_code < 500 && status_code <= 500;
189   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
190   |
191note: `if `status_code < 500` evaluates to true, status_code <= 500` will always evaluate to true as well
192  --> $DIR/const_comparisons.rs:127:23
193   |
194LL |     status_code < 500 && status_code <= 500;
195   |                       ^^^^^^^^^^^^^^^^^^^^^
196
197error: boolean expression will never evaluate to 'true'
198  --> $DIR/const_comparisons.rs:132:5
199   |
200LL |     name < "Jennifer" && name > "Shannon";
201   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
202   |
203   = note: since `"Jennifer"` < `"Shannon"`, the expression evaluates to false for any value of `name`
204
205error: boolean expression will never evaluate to 'true'
206  --> $DIR/const_comparisons.rs:137:5
207   |
208LL |     numbers < [3, 4] && numbers > [5, 6];
209   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
210   |
211   = note: since `[3, 4]` < `[5, 6]`, the expression evaluates to false for any value of `numbers`
212
213error: boolean expression will never evaluate to 'true'
214  --> $DIR/const_comparisons.rs:142:5
215   |
216LL |     letter < 'b' && letter > 'c';
217   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
218   |
219   = note: since `'b'` < `'c'`, the expression evaluates to false for any value of `letter`
220
221error: boolean expression will never evaluate to 'true'
222  --> $DIR/const_comparisons.rs:147:5
223   |
224LL |     area < std::f32::consts::E && area > std::f32::consts::PI;
225   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
226   |
227   = note: since `std::f32::consts::E` < `std::f32::consts::PI`, the expression evaluates to false for any value of `area`
228
229error: aborting due to 25 previous errors
230