rust-clippy/tests/ui/manual_clamp.stderr
2024-02-17 12:34:54 +00:00

406 lines
13 KiB
Text

error: clamp-like pattern without using clamp function
--> tests/ui/manual_clamp.rs:94:5
|
LL | / if x9 < min {
LL | |
LL | |
LL | | x9 = min;
... |
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`
= help: to override `-D warnings` add `#[allow(clippy::manual_clamp)]`
error: clamp-like pattern without using clamp function
--> tests/ui/manual_clamp.rs:113:5
|
LL | / if x11 > max {
LL | |
LL | |
LL | | x11 = max;
... |
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
--> tests/ui/manual_clamp.rs:123:5
|
LL | / if min > x12 {
LL | |
LL | |
LL | | x12 = min;
... |
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
--> tests/ui/manual_clamp.rs:133:5
|
LL | / if max < x13 {
LL | |
LL | |
LL | | x13 = max;
... |
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
--> tests/ui/manual_clamp.rs:227:5
|
LL | / if max < x33 {
LL | |
LL | |
LL | | x33 = max;
... |
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
--> tests/ui/manual_clamp.rs:21:14
|
LL | let x0 = if max < input {
| ______________^
LL | |
LL | |
LL | | max
... |
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
--> tests/ui/manual_clamp.rs:31:14
|
LL | let x1 = if input > max {
| ______________^
LL | |
LL | |
LL | | max
... |
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
--> tests/ui/manual_clamp.rs:41:14
|
LL | let x2 = 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: clamp-like pattern without using clamp function
--> tests/ui/manual_clamp.rs:51:14
|
LL | let x3 = if min > input {
| ______________^
LL | |
LL | |
LL | | min
... |
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
--> tests/ui/manual_clamp.rs:61:14
|
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
--> tests/ui/manual_clamp.rs:65:14
|
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
--> tests/ui/manual_clamp.rs:69:14
|
LL | let x6 = match input {
| ______________^
LL | |
LL | |
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
--> tests/ui/manual_clamp.rs:77:14
|
LL | let x7 = match input {
| ______________^
LL | |
LL | |
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
--> tests/ui/manual_clamp.rs:85:14
|
LL | let x8 = match input {
| ______________^
LL | |
LL | |
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
--> tests/ui/manual_clamp.rs:103:15
|
LL | let x10 = match input {
| _______________^
LL | |
LL | |
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
--> tests/ui/manual_clamp.rs:142:15
|
LL | let x14 = if input > CONST_MAX {
| _______________^
LL | |
LL | |
LL | | CONST_MAX
... |
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
--> tests/ui/manual_clamp.rs:153:19
|
LL | let x15 = if input > max {
| ___________________^
LL | |
LL | |
LL | | max
... |
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
--> tests/ui/manual_clamp.rs:166:19
|
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
--> tests/ui/manual_clamp.rs:169:19
|
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
--> tests/ui/manual_clamp.rs:172:19
|
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
--> tests/ui/manual_clamp.rs:175:19
|
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
--> tests/ui/manual_clamp.rs:178:19
|
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
--> tests/ui/manual_clamp.rs:181:19
|
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
--> tests/ui/manual_clamp.rs:184:19
|
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
--> tests/ui/manual_clamp.rs:187:19
|
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
--> tests/ui/manual_clamp.rs:191:19
|
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
--> tests/ui/manual_clamp.rs:194:19
|
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
--> tests/ui/manual_clamp.rs:197:19
|
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
--> tests/ui/manual_clamp.rs:200:19
|
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
--> tests/ui/manual_clamp.rs:203:19
|
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
--> tests/ui/manual_clamp.rs:206:19
|
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
--> tests/ui/manual_clamp.rs:209:19
|
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
--> tests/ui/manual_clamp.rs:212:19
|
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
--> tests/ui/manual_clamp.rs:217:5
|
LL | / if x32 < min {
LL | |
LL | |
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
--> tests/ui/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