rust-clippy/tests/ui/manual_clamp.stderr

406 lines
13 KiB
Text
Raw Normal View History

2022-09-16 02:50:28 +00:00
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:94:5
2022-09-16 02:50:28 +00:00
|
LL | / if x9 < min {
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | x9 = min;
... |
2022-09-16 02:50:28 +00:00
LL | | x9 = max;
LL | | }
| |_____^ help: replace with clamp: `x9 = x9.clamp(min, max);`
|
= note: clamp will panic if max < min
= note: `-D clippy::manual-clamp` implied by `-D warnings`
2022-09-16 02:50:28 +00:00
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:113:5
2022-09-16 02:50:28 +00:00
|
LL | / if x11 > max {
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | x11 = max;
... |
2022-09-16 02:50:28 +00:00
LL | | x11 = min;
LL | | }
| |_____^ help: replace with clamp: `x11 = x11.clamp(min, max);`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:123:5
2022-09-16 02:50:28 +00:00
|
LL | / if min > x12 {
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | x12 = min;
... |
2022-09-16 02:50:28 +00:00
LL | | x12 = max;
LL | | }
| |_____^ help: replace with clamp: `x12 = x12.clamp(min, max);`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:133:5
2022-09-16 02:50:28 +00:00
|
LL | / if max < x13 {
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | x13 = max;
... |
2022-09-16 02:50:28 +00:00
LL | | x13 = min;
LL | | }
| |_____^ help: replace with clamp: `x13 = x13.clamp(min, max);`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:227:5
2022-09-16 02:50:28 +00:00
|
LL | / if max < x33 {
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | x33 = max;
... |
2022-09-16 02:50:28 +00:00
LL | | x33 = min;
LL | | }
| |_____^ help: replace with clamp: `x33 = x33.clamp(min, max);`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:21:14
2022-09-16 02:50:28 +00:00
|
LL | let x0 = if max < input {
| ______________^
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | max
... |
2022-09-16 02:50:28 +00:00
LL | | input
LL | | };
| |_____^ help: replace with clamp: `input.clamp(min, max)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:31:14
2022-09-16 02:50:28 +00:00
|
LL | let x1 = if input > max {
| ______________^
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | max
... |
2022-09-16 02:50:28 +00:00
LL | | input
LL | | };
| |_____^ help: replace with clamp: `input.clamp(min, max)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:41:14
2022-09-16 02:50:28 +00:00
|
LL | let x2 = if input < min {
| ______________^
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | min
... |
2022-09-16 02:50:28 +00:00
LL | | input
LL | | };
| |_____^ help: replace with clamp: `input.clamp(min, max)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:51:14
2022-09-16 02:50:28 +00:00
|
LL | let x3 = if min > input {
| ______________^
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | min
... |
2022-09-16 02:50:28 +00:00
LL | | input
LL | | };
| |_____^ help: replace with clamp: `input.clamp(min, max)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:61:14
2022-09-16 02:50:28 +00:00
|
LL | let x4 = input.max(min).min(max);
| ^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(min, max)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:65:14
2022-09-16 02:50:28 +00:00
|
LL | let x5 = input.min(max).max(min);
| ^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(min, max)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:69:14
2022-09-16 02:50:28 +00:00
|
LL | let x6 = match input {
| ______________^
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | x if x > max => max,
LL | | x if x < min => min,
LL | | x => x,
LL | | };
| |_____^ help: replace with clamp: `input.clamp(min, max)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:77:14
2022-09-16 02:50:28 +00:00
|
LL | let x7 = match input {
| ______________^
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | x if x < min => min,
LL | | x if x > max => max,
LL | | x => x,
LL | | };
| |_____^ help: replace with clamp: `input.clamp(min, max)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:85:14
2022-09-16 02:50:28 +00:00
|
LL | let x8 = match input {
| ______________^
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | x if max < x => max,
LL | | x if min > x => min,
LL | | x => x,
LL | | };
| |_____^ help: replace with clamp: `input.clamp(min, max)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:103:15
2022-09-16 02:50:28 +00:00
|
LL | let x10 = match input {
| _______________^
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | x if min > x => min,
LL | | x if max < x => max,
LL | | x => x,
LL | | };
| |_____^ help: replace with clamp: `input.clamp(min, max)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:142:15
2022-09-16 02:50:28 +00:00
|
LL | let x14 = if input > CONST_MAX {
| _______________^
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | CONST_MAX
... |
2022-09-16 02:50:28 +00:00
LL | | input
LL | | };
| |_____^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:153:19
2022-09-16 02:50:28 +00:00
|
LL | let x15 = if input > max {
| ___________________^
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | max
... |
2022-09-16 02:50:28 +00:00
LL | | input
LL | | };
| |_________^ help: replace with clamp: `input.clamp(min, max)`
|
= note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
= note: clamp returns NaN if the input is NaN
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:166:19
2022-09-16 02:50:28 +00:00
|
LL | let x16 = cmp_max(cmp_min(input, CONST_MAX), CONST_MIN);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:169:19
2022-09-16 02:50:28 +00:00
|
LL | let x17 = cmp_min(cmp_max(input, CONST_MIN), CONST_MAX);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:172:19
2022-09-16 02:50:28 +00:00
|
LL | let x18 = cmp_max(CONST_MIN, cmp_min(input, CONST_MAX));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:175:19
2022-09-16 02:50:28 +00:00
|
LL | let x19 = cmp_min(CONST_MAX, cmp_max(input, CONST_MIN));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:178:19
2022-09-16 02:50:28 +00:00
|
LL | let x20 = cmp_max(cmp_min(CONST_MAX, input), CONST_MIN);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:181:19
2022-09-16 02:50:28 +00:00
|
LL | let x21 = cmp_min(cmp_max(CONST_MIN, input), CONST_MAX);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:184:19
2022-09-16 02:50:28 +00:00
|
LL | let x22 = cmp_max(CONST_MIN, cmp_min(CONST_MAX, input));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:187:19
2022-09-16 02:50:28 +00:00
|
LL | let x23 = cmp_min(CONST_MAX, cmp_max(CONST_MIN, input));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_MIN, CONST_MAX)`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:191:19
2022-09-16 02:50:28 +00:00
|
LL | let x24 = f64::max(f64::min(input, CONST_F64_MAX), CONST_F64_MIN);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
|
= note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
= note: clamp returns NaN if the input is NaN
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:194:19
2022-09-16 02:50:28 +00:00
|
LL | let x25 = f64::min(f64::max(input, CONST_F64_MIN), CONST_F64_MAX);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
|
= note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
= note: clamp returns NaN if the input is NaN
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:197:19
2022-09-16 02:50:28 +00:00
|
LL | let x26 = f64::max(CONST_F64_MIN, f64::min(input, CONST_F64_MAX));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
|
= note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
= note: clamp returns NaN if the input is NaN
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:200:19
2022-09-16 02:50:28 +00:00
|
LL | let x27 = f64::min(CONST_F64_MAX, f64::max(input, CONST_F64_MIN));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
|
= note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
= note: clamp returns NaN if the input is NaN
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:203:19
2022-09-16 02:50:28 +00:00
|
LL | let x28 = f64::max(f64::min(CONST_F64_MAX, input), CONST_F64_MIN);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
|
= note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
= note: clamp returns NaN if the input is NaN
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:206:19
2022-09-16 02:50:28 +00:00
|
LL | let x29 = f64::min(f64::max(CONST_F64_MIN, input), CONST_F64_MAX);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
|
= note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
= note: clamp returns NaN if the input is NaN
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:209:19
2022-09-16 02:50:28 +00:00
|
LL | let x30 = f64::max(CONST_F64_MIN, f64::min(CONST_F64_MAX, input));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
|
= note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
= note: clamp returns NaN if the input is NaN
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:212:19
2022-09-16 02:50:28 +00:00
|
LL | let x31 = f64::min(CONST_F64_MAX, f64::max(CONST_F64_MIN, input));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with clamp: `input.clamp(CONST_F64_MIN, CONST_F64_MAX)`
|
= note: clamp will panic if max < min, min.is_nan(), or max.is_nan()
= note: clamp returns NaN if the input is NaN
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:217:5
2022-09-16 02:50:28 +00:00
|
LL | / if x32 < min {
LL | |
LL | |
2022-09-16 02:50:28 +00:00
LL | | x32 = min;
LL | | } else if x32 > max {
LL | | x32 = max;
LL | | }
| |_____^ help: replace with clamp: `x32 = x32.clamp(min, max);`
|
= note: clamp will panic if max < min
error: clamp-like pattern without using clamp function
--> $DIR/manual_clamp.rs:389:13
|
LL | let _ = if input < min {
| _____________^
LL | |
LL | |
LL | | min
... |
LL | | input
LL | | };
| |_____^ help: replace with clamp: `input.clamp(min, max)`
|
= note: clamp will panic if max < min
error: aborting due to 35 previous errors
2022-09-16 02:50:28 +00:00