fork/rust

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

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

master
12.7 KiB406 linesraw
1error: clamp-like pattern without using clamp function
2  --> $DIR/manual_clamp.rs:94:5
3   |
4LL | /     if x9 < min {
5LL | |
6LL | |
7LL | |         x9 = min;
8...  |
9LL | |         x9 = max;
10LL | |     }
11   | |_____^ help: replace with clamp: `x9 = x9.clamp(min, max);`
12   |
13   = note: clamp will panic if max < min
14   = note: `-D clippy::manual-clamp` implied by `-D warnings`
15   = help: to override `-D warnings` add `#[allow(clippy::manual_clamp)]`
16
17error: clamp-like pattern without using clamp function
18  --> $DIR/manual_clamp.rs:113:5
19   |
20LL | /     if x11 > max {
21LL | |
22LL | |
23LL | |         x11 = max;
24...  |
25LL | |         x11 = min;
26LL | |     }
27   | |_____^ help: replace with clamp: `x11 = x11.clamp(min, max);`
28   |
29   = note: clamp will panic if max < min
30
31error: clamp-like pattern without using clamp function
32  --> $DIR/manual_clamp.rs:123:5
33   |
34LL | /     if min > x12 {
35LL | |
36LL | |
37LL | |         x12 = min;
38...  |
39LL | |         x12 = max;
40LL | |     }
41   | |_____^ help: replace with clamp: `x12 = x12.clamp(min, max);`
42   |
43   = note: clamp will panic if max < min
44
45error: clamp-like pattern without using clamp function
46  --> $DIR/manual_clamp.rs:133:5
47   |
48LL | /     if max < x13 {
49LL | |
50LL | |
51LL | |         x13 = max;
52...  |
53LL | |         x13 = min;
54LL | |     }
55   | |_____^ help: replace with clamp: `x13 = x13.clamp(min, max);`
56   |
57   = note: clamp will panic if max < min
58
59error: clamp-like pattern without using clamp function
60  --> $DIR/manual_clamp.rs:227:5
61   |
62LL | /     if max < x33 {
63LL | |
64LL | |
65LL | |         x33 = max;
66...  |
67LL | |         x33 = min;
68LL | |     }
69   | |_____^ help: replace with clamp: `x33 = x33.clamp(min, max);`
70   |
71   = note: clamp will panic if max < min
72
73error: clamp-like pattern without using clamp function
74  --> $DIR/manual_clamp.rs:21:14
75   |
76LL |       let x0 = if max < input {
77   |  ______________^
78LL | |
79LL | |
80LL | |         max
81...  |
82LL | |         input
83LL | |     };
84   | |_____^ help: replace with clamp: `input.clamp(min, max)`
85   |
86   = note: clamp will panic if max < min
87
88error: clamp-like pattern without using clamp function
89  --> $DIR/manual_clamp.rs:31:14
90   |
91LL |       let x1 = if input > max {
92   |  ______________^
93LL | |
94LL | |
95LL | |         max
96...  |
97LL | |         input
98LL | |     };
99   | |_____^ help: replace with clamp: `input.clamp(min, max)`
100   |
101   = note: clamp will panic if max < min
102
103error: clamp-like pattern without using clamp function
104  --> $DIR/manual_clamp.rs:41:14
105   |
106LL |       let x2 = if input < min {
107   |  ______________^
108LL | |
109LL | |
110LL | |         min
111...  |
112LL | |         input
113LL | |     };
114   | |_____^ help: replace with clamp: `input.clamp(min, max)`
115   |
116   = note: clamp will panic if max < min
117
118error: clamp-like pattern without using clamp function
119  --> $DIR/manual_clamp.rs:51:14
120   |
121LL |       let x3 = if min > input {
122   |  ______________^
123LL | |
124LL | |
125LL | |         min
126...  |
127LL | |         input
128LL | |     };
129   | |_____^ help: replace with clamp: `input.clamp(min, max)`
130   |
131   = note: clamp will panic if max < min
132
133error: clamp-like pattern without using clamp function
134  --> $DIR/manual_clamp.rs:61:14
135   |
136LL |     let x4 = input.max(min).min(max);
137   |              ^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(min, max)`
138   |
139   = note: clamp will panic if max < min
140
141error: clamp-like pattern without using clamp function
142  --> $DIR/manual_clamp.rs:65:14
143   |
144LL |     let x5 = input.min(max).max(min);
145   |              ^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(min, max)`
146   |
147   = note: clamp will panic if max < min
148
149error: clamp-like pattern without using clamp function
150  --> $DIR/manual_clamp.rs:69:14
151   |
152LL |       let x6 = match input {
153   |  ______________^
154LL | |
155LL | |
156LL | |         x if x > max => max,
157LL | |         x if x < min => min,
158LL | |         x => x,
159LL | |     };
160   | |_____^ help: replace with clamp: `input.clamp(min, max)`
161   |
162   = note: clamp will panic if max < min
163
164error: clamp-like pattern without using clamp function
165  --> $DIR/manual_clamp.rs:77:14
166   |
167LL |       let x7 = match input {
168   |  ______________^
169LL | |
170LL | |
171LL | |         x if x < min => min,
172LL | |         x if x > max => max,
173LL | |         x => x,
174LL | |     };
175   | |_____^ help: replace with clamp: `input.clamp(min, max)`
176   |
177   = note: clamp will panic if max < min
178
179error: clamp-like pattern without using clamp function
180  --> $DIR/manual_clamp.rs:85:14
181   |
182LL |       let x8 = match input {
183   |  ______________^
184LL | |
185LL | |
186LL | |         x if max < x => max,
187LL | |         x if min > x => min,
188LL | |         x => x,
189LL | |     };
190   | |_____^ help: replace with clamp: `input.clamp(min, max)`
191   |
192   = note: clamp will panic if max < min
193
194error: clamp-like pattern without using clamp function
195  --> $DIR/manual_clamp.rs:103:15
196   |
197LL |       let x10 = match input {
198   |  _______________^
199LL | |
200LL | |
201LL | |         x if min > x => min,
202LL | |         x if max < x => max,
203LL | |         x => x,
204LL | |     };
205   | |_____^ help: replace with clamp: `input.clamp(min, max)`
206   |
207   = note: clamp will panic if max < min
208
209error: clamp-like pattern without using clamp function
210  --> $DIR/manual_clamp.rs:142:15
211   |
212LL |       let x14 = if input > CONST_MAX {
213   |  _______________^
214LL | |
215LL | |
216LL | |         CONST_MAX
217...  |
218LL | |         input
219LL | |     };
220   | |_____^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
221   |
222   = note: clamp will panic if max < min
223
224error: clamp-like pattern without using clamp function
225  --> $DIR/manual_clamp.rs:153:19
226   |
227LL |           let x15 = if input > max {
228   |  ___________________^
229LL | |
230LL | |
231LL | |             max
232...  |
233LL | |             input
234LL | |         };
235   | |_________^ help: replace with clamp: `input.clamp(min, max)`
236   |
237   = note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
238   = note: clamp returns NaN if the input is NaN
239
240error: clamp-like pattern without using clamp function
241  --> $DIR/manual_clamp.rs:166:19
242   |
243LL |         let x16 = cmp_max(cmp_min(input, CONST_MAX), CONST_MIN);
244   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
245   |
246   = note: clamp will panic if max < min
247
248error: clamp-like pattern without using clamp function
249  --> $DIR/manual_clamp.rs:169:19
250   |
251LL |         let x17 = cmp_min(cmp_max(input, CONST_MIN), CONST_MAX);
252   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
253   |
254   = note: clamp will panic if max < min
255
256error: clamp-like pattern without using clamp function
257  --> $DIR/manual_clamp.rs:172:19
258   |
259LL |         let x18 = cmp_max(CONST_MIN, cmp_min(input, CONST_MAX));
260   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
261   |
262   = note: clamp will panic if max < min
263
264error: clamp-like pattern without using clamp function
265  --> $DIR/manual_clamp.rs:175:19
266   |
267LL |         let x19 = cmp_min(CONST_MAX, cmp_max(input, CONST_MIN));
268   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
269   |
270   = note: clamp will panic if max < min
271
272error: clamp-like pattern without using clamp function
273  --> $DIR/manual_clamp.rs:178:19
274   |
275LL |         let x20 = cmp_max(cmp_min(CONST_MAX, input), CONST_MIN);
276   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
277   |
278   = note: clamp will panic if max < min
279
280error: clamp-like pattern without using clamp function
281  --> $DIR/manual_clamp.rs:181:19
282   |
283LL |         let x21 = cmp_min(cmp_max(CONST_MIN, input), CONST_MAX);
284   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
285   |
286   = note: clamp will panic if max < min
287
288error: clamp-like pattern without using clamp function
289  --> $DIR/manual_clamp.rs:184:19
290   |
291LL |         let x22 = cmp_max(CONST_MIN, cmp_min(CONST_MAX, input));
292   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
293   |
294   = note: clamp will panic if max < min
295
296error: clamp-like pattern without using clamp function
297  --> $DIR/manual_clamp.rs:187:19
298   |
299LL |         let x23 = cmp_min(CONST_MAX, cmp_max(CONST_MIN, input));
300   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
301   |
302   = note: clamp will panic if max < min
303
304error: clamp-like pattern without using clamp function
305  --> $DIR/manual_clamp.rs:191:19
306   |
307LL |         let x24 = f64::max(f64::min(input, CONST_F64_MAX), CONST_F64_MIN);
308   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
309   |
310   = note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
311   = note: clamp returns NaN if the input is NaN
312
313error: clamp-like pattern without using clamp function
314  --> $DIR/manual_clamp.rs:194:19
315   |
316LL |         let x25 = f64::min(f64::max(input, CONST_F64_MIN), CONST_F64_MAX);
317   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
318   |
319   = note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
320   = note: clamp returns NaN if the input is NaN
321
322error: clamp-like pattern without using clamp function
323  --> $DIR/manual_clamp.rs:197:19
324   |
325LL |         let x26 = f64::max(CONST_F64_MIN, f64::min(input, CONST_F64_MAX));
326   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
327   |
328   = note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
329   = note: clamp returns NaN if the input is NaN
330
331error: clamp-like pattern without using clamp function
332  --> $DIR/manual_clamp.rs:200:19
333   |
334LL |         let x27 = f64::min(CONST_F64_MAX, f64::max(input, CONST_F64_MIN));
335   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
336   |
337   = note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
338   = note: clamp returns NaN if the input is NaN
339
340error: clamp-like pattern without using clamp function
341  --> $DIR/manual_clamp.rs:203:19
342   |
343LL |         let x28 = f64::max(f64::min(CONST_F64_MAX, input), CONST_F64_MIN);
344   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
345   |
346   = note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
347   = note: clamp returns NaN if the input is NaN
348
349error: clamp-like pattern without using clamp function
350  --> $DIR/manual_clamp.rs:206:19
351   |
352LL |         let x29 = f64::min(f64::max(CONST_F64_MIN, input), CONST_F64_MAX);
353   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
354   |
355   = note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
356   = note: clamp returns NaN if the input is NaN
357
358error: clamp-like pattern without using clamp function
359  --> $DIR/manual_clamp.rs:209:19
360   |
361LL |         let x30 = f64::max(CONST_F64_MIN, f64::min(CONST_F64_MAX, input));
362   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
363   |
364   = note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
365   = note: clamp returns NaN if the input is NaN
366
367error: clamp-like pattern without using clamp function
368  --> $DIR/manual_clamp.rs:212:19
369   |
370LL |         let x31 = f64::min(CONST_F64_MAX, f64::max(CONST_F64_MIN, input));
371   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
372   |
373   = note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
374   = note: clamp returns NaN if the input is NaN
375
376error: clamp-like pattern without using clamp function
377  --> $DIR/manual_clamp.rs:217:5
378   |
379LL | /     if x32 < min {
380LL | |
381LL | |
382LL | |         x32 = min;
383LL | |     } else if x32 > max {
384LL | |         x32 = max;
385LL | |     }
386   | |_____^ help: replace with clamp: `x32 = x32.clamp(min, max);`
387   |
388   = note: clamp will panic if max < min
389
390error: clamp-like pattern without using clamp function
391  --> $DIR/manual_clamp.rs:389:13
392   |
393LL |       let _ = if input < min {
394   |  _____________^
395LL | |
396LL | |
397LL | |         min
398...  |
399LL | |         input
400LL | |     };
401   | |_____^ help: replace with clamp: `input.clamp(min, max)`
402   |
403   = note: clamp will panic if max < min
404
405error: aborting due to 35 previous errors
406