Skip to content

Conversation

@andjsrk
Copy link

@andjsrk andjsrk commented Dec 26, 2025

AFAIK [0; 3] is basically a syntax sugar for [0, 0, 0] so it should return whether the repeat's element can have side effects, like what it does on arrays.
And it seems that the rule for unary operators and indexings can be applied to binary operators as well.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 26, 2025

r? @jdonszelmann

rustbot has assigned @jdonszelmann.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
tests/ui/should_impl_trait/method_list_2.rs (revision `edition2021`) ... ok
tests/ui/crashes/third-party/conf_allowlisted.rs ... ok

FAILED TEST: tests/ui/manual_clamp.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/manual_clamp.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a9034e1031764ee4.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a9034e1031764ee4.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-49215d6c78da5485.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-49215d6c78da5485.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-647c6467502a5c31.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-647c6467502a5c31.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-e492cfb623514f4f.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-e492cfb623514f4f.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-5c45143607600b30.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-5c45143607600b30.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-6ecd666cd642c024.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-6ecd666cd642c024.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-b4b7e251597dd4a9.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-b4b7e251597dd4a9.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-ba360121f8a9307c.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-ba360121f8a9307c.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-6ddc89563990f085.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-6ddc89563990f085.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/manual_clamp.stderr` to the actual output
--- tests/ui/manual_clamp.stderr
+++ <stderr output>
 error: clamp-like pattern without using clamp function
   --> tests/ui/manual_clamp.rs:212:5
... 381 lines skipped ...
    = note: clamp will panic if max < min
 
+error: this match expression is unnecessary
+  --> tests/ui/manual_clamp.rs:408:14
+   |
+LL |       let x6 = match input {
+   |  ______________^
+LL | |         x if x < CONST_MAX => x,
+LL | |         x if x < CONST_MIN => x,
+LL | |         x => x,
+LL | |     };
+   | |_____^ help: replace it with: `input`
+   |
+   = note: `-D clippy::needless-match` implied by `-D warnings`
+   = help: to override `-D warnings` add `#[allow(clippy::needless_match)]`
+
 error: clamp-like pattern without using clamp function
   --> tests/ui/manual_clamp.rs:525:13
... 11 lines skipped ...
    = note: clamp will panic if max < min
 
-error: aborting due to 35 previous errors
+error: aborting due to 36 previous errors
 

Full unnormalized output:
error: clamp-like pattern without using clamp function
##[error]  --> tests/ui/manual_clamp.rs:212:5
   |
LL | /     if x9 < CONST_MIN {
LL | |
LL | |
LL | |         x9 = CONST_MIN;
...  |
LL | |         x9 = CONST_MAX;
LL | |     }
   | |_____^ help: replace with clamp: `x9 = x9.clamp(CONST_MIN, CONST_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
##[error]  --> tests/ui/manual_clamp.rs:230:5
   |
LL | /     if x11 > CONST_MAX {
LL | |
LL | |
LL | |         x11 = CONST_MAX;
...  |
LL | |         x11 = CONST_MIN;
LL | |     }
   | |_____^ help: replace with clamp: `x11 = x11.clamp(CONST_MIN, CONST_MAX);`
   |
   = note: clamp will panic if max < min

error: clamp-like pattern without using clamp function
##[error]  --> tests/ui/manual_clamp.rs:240:5
   |
LL | /     if CONST_MIN > x12 {
LL | |
LL | |
LL | |         x12 = CONST_MIN;
...  |
LL | |         x12 = CONST_MAX;
LL | |     }
   | |_____^ help: replace with clamp: `x12 = x12.clamp(CONST_MIN, CONST_MAX);`
   |
   = note: clamp will panic if max < min

error: clamp-like pattern without using clamp function
##[error]  --> tests/ui/manual_clamp.rs:250:5
   |
LL | /     if CONST_MAX < x13 {
LL | |
LL | |
LL | |         x13 = CONST_MAX;
...  |
LL | |         x13 = CONST_MIN;
LL | |     }
   | |_____^ help: replace with clamp: `x13 = x13.clamp(CONST_MIN, CONST_MAX);`
   |
   = note: clamp will panic if max < min

error: clamp-like pattern without using clamp function
##[error]  --> tests/ui/manual_clamp.rs:363:5
   |
LL | /     if CONST_MAX < x35 {
LL | |
LL | |
LL | |         x35 = CONST_MAX;
...  |
LL | |         x35 = CONST_MIN;
LL | |     }
   | |_____^ help: replace with clamp: `x35 = x35.clamp(CONST_MIN, CONST_MAX);`
   |
   = note: clamp will panic if max < min

error: clamp-like pattern without using clamp function
##[error]  --> tests/ui/manual_clamp.rs:144:14
   |
LL |       let x0 = if CONST_MAX < input {
   |  ______________^
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
##[error]  --> tests/ui/manual_clamp.rs:154:14
   |
LL |       let x1 = 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
##[error]  --> tests/ui/manual_clamp.rs:164:14
   |
LL |       let x2 = if input < CONST_MIN {
   |  ______________^
LL | |
LL | |
LL | |         CONST_MIN
...  |
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
##[error]  --> tests/ui/manual_clamp.rs:174:14
   |
LL |       let x3 = if CONST_MIN > input {
---
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
##[error]  --> tests/ui/manual_clamp.rs:184:14
   |
LL |     let x4 = input.max(CONST_MIN).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
##[error]  --> tests/ui/manual_clamp.rs:187:14
   |
LL |     let x5 = input.min(CONST_MAX).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
##[error]  --> tests/ui/manual_clamp.rs:190:14
   |
LL |       let x6 = match input {
   |  ______________^
LL | |
LL | |         x if x > CONST_MAX => CONST_MAX,
LL | |         x if x < CONST_MIN => CONST_MIN,
LL | |         x => x,
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
##[error]  --> tests/ui/manual_clamp.rs:197:14
   |
LL |       let x7 = match input {
   |  ______________^
LL | |
LL | |         x if x < CONST_MIN => CONST_MIN,
LL | |         x if x > CONST_MAX => CONST_MAX,
LL | |         x => x,
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
##[error]  --> tests/ui/manual_clamp.rs:204:14
   |
LL |       let x8 = match input {
   |  ______________^
LL | |
LL | |         x if CONST_MAX < x => CONST_MAX,
LL | |         x if CONST_MIN > x => CONST_MIN,
LL | |         x => x,
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
##[error]  --> tests/ui/manual_clamp.rs:221:15
   |
LL |       let x10 = match input {
   |  _______________^
LL | |
LL | |         x if CONST_MIN > x => CONST_MIN,
LL | |         x if CONST_MAX < x => CONST_MAX,
LL | |         x => x,
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
##[error]  --> tests/ui/manual_clamp.rs:259: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
##[error]  --> tests/ui/manual_clamp.rs:270:19
   |
LL |           let x15 = if input > CONST_F64_MAX {
   |  ___________________^
LL | |
LL | |
LL | |             CONST_F64_MAX
...  |
LL | |             input
LL | |         };
   | |_________^ 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
##[error]  --> tests/ui/manual_clamp.rs:283: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
##[error]  --> tests/ui/manual_clamp.rs:286: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
##[error]  --> tests/ui/manual_clamp.rs:289: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
##[error]  --> tests/ui/manual_clamp.rs:292: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
##[error]  --> tests/ui/manual_clamp.rs:295: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
##[error]  --> tests/ui/manual_clamp.rs:298: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
##[error]  --> tests/ui/manual_clamp.rs:301: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
##[error]  --> tests/ui/manual_clamp.rs:304: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
##[error]  --> tests/ui/manual_clamp.rs:308: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
##[error]  --> tests/ui/manual_clamp.rs:311: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
##[error]  --> tests/ui/manual_clamp.rs:314: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
##[error]  --> tests/ui/manual_clamp.rs:317: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
##[error]  --> tests/ui/manual_clamp.rs:320: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
##[error]  --> tests/ui/manual_clamp.rs:323: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
##[error]  --> tests/ui/manual_clamp.rs:326: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
##[error]  --> tests/ui/manual_clamp.rs:329: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
##[error]  --> tests/ui/manual_clamp.rs:333:5
   |
LL | /     if x32 < CONST_MIN {
LL | |
LL | |
LL | |         x32 = CONST_MIN;
LL | |     } else if x32 > CONST_MAX {
LL | |         x32 = CONST_MAX;
LL | |     }
   | |_____^ help: replace with clamp: `x32 = x32.clamp(CONST_MIN, CONST_MAX);`
   |
   = note: clamp will panic if max < min

error: this match expression is unnecessary
##[error]  --> tests/ui/manual_clamp.rs:408:14
   |
LL |       let x6 = match input {
   |  ______________^
LL | |         x if x < CONST_MAX => x,
LL | |         x if x < CONST_MIN => x,
LL | |         x => x,
LL | |     };
   | |_____^ help: replace it with: `input`
   |
   = note: `-D clippy::needless-match` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_match)]`

error: clamp-like pattern without using clamp function
##[error]  --> tests/ui/manual_clamp.rs:525:13
   |
LL |       let _ = 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: aborting due to 36 previous errors



error: there was 1 unmatched diagnostic
##[error]   --> tests/ui/manual_clamp.rs:408:14
    |
408 |       let x6 = match input {
    |  ______________^
409 | |         x if x < CONST_MAX => x,
410 | |         x if x < CONST_MIN => x,
411 | |         x => x,
412 | |     };
    | |_____^ Error[clippy::needless_match]: this match expression is unnecessary
    |

full stderr:
error: clamp-like pattern without using clamp function
##[error]  --> tests/ui/manual_clamp.rs:212:5
   |
LL | /     if x9 < CONST_MIN {
LL | |
LL | |
LL | |         x9 = CONST_MIN;
...  |
LL | |         x9 = CONST_MAX;
LL | |     }
   | |_____^ help: replace with clamp: `x9 = x9.clamp(CONST_MIN, CONST_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
##[error]  --> tests/ui/manual_clamp.rs:230:5
   |
LL | /     if x11 > CONST_MAX {
LL | |
LL | |
LL | |         x11 = CONST_MAX;
...  |
LL | |         x11 = CONST_MIN;
LL | |     }
   | |_____^ help: replace with clamp: `x11 = x11.clamp(CONST_MIN, CONST_MAX);`
   |
   = note: clamp will panic if max < min

error: clamp-like pattern without using clamp function
##[error]  --> tests/ui/manual_clamp.rs:240:5
   |
LL | /     if CONST_MIN > x12 {
LL | |
LL | |
LL | |         x12 = CONST_MIN;
...  |
LL | |         x12 = CONST_MAX;
LL | |     }
   | |_____^ help: replace with clamp: `x12 = x12.clamp(CONST_MIN, CONST_MAX);`
   |
   = note: clamp will panic if max < min

error: clamp-like pattern without using clamp function
##[error]  --> tests/ui/manual_clamp.rs:250:5
   |
LL | /     if CONST_MAX < x13 {
LL | |
LL | |
LL | |         x13 = CONST_MAX;
...  |
LL | |         x13 = CONST_MIN;
LL | |     }
   | |_____^ help: replace with clamp: `x13 = x13.clamp(CONST_MIN, CONST_MAX);`
   |
   = note: clamp will panic if max < min

error: clamp-like pattern without using clamp function
##[error]  --> tests/ui/manual_clamp.rs:363:5
   |
LL | /     if CONST_MAX < x35 {
LL | |
LL | |
LL | |         x35 = CONST_MAX;
...  |
LL | |         x35 = CONST_MIN;
LL | |     }
   | |_____^ help: replace with clamp: `x35 = x35.clamp(CONST_MIN, CONST_MAX);`
   |
   = note: clamp will panic if max < min

error: clamp-like pattern without using clamp function
##[error]  --> tests/ui/manual_clamp.rs:144:14
   |
LL |       let x0 = if CONST_MAX < input {
   |  ______________^
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
##[error]  --> tests/ui/manual_clamp.rs:154:14
   |
LL |       let x1 = 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
##[error]  --> tests/ui/manual_clamp.rs:164:14
   |
LL |       let x2 = if input < CONST_MIN {
   |  ______________^
LL | |
LL | |
LL | |         CONST_MIN
...  |
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
##[error]  --> tests/ui/manual_clamp.rs:174:14
   |
LL |       let x3 = if CONST_MIN > input {
---
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
##[error]  --> tests/ui/manual_clamp.rs:184:14
   |
LL |     let x4 = input.max(CONST_MIN).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
##[error]  --> tests/ui/manual_clamp.rs:187:14
   |
LL |     let x5 = input.min(CONST_MAX).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
##[error]  --> tests/ui/manual_clamp.rs:190:14
   |
LL |       let x6 = match input {
   |  ______________^
LL | |
LL | |         x if x > CONST_MAX => CONST_MAX,
LL | |         x if x < CONST_MIN => CONST_MIN,
LL | |         x => x,
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
##[error]  --> tests/ui/manual_clamp.rs:197:14
   |
LL |       let x7 = match input {
   |  ______________^
LL | |
LL | |         x if x < CONST_MIN => CONST_MIN,
LL | |         x if x > CONST_MAX => CONST_MAX,
LL | |         x => x,
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
##[error]  --> tests/ui/manual_clamp.rs:204:14
   |
LL |       let x8 = match input {
   |  ______________^
LL | |
LL | |         x if CONST_MAX < x => CONST_MAX,
LL | |         x if CONST_MIN > x => CONST_MIN,
LL | |         x => x,
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
##[error]  --> tests/ui/manual_clamp.rs:221:15
   |
LL |       let x10 = match input {
   |  _______________^
LL | |
LL | |         x if CONST_MIN > x => CONST_MIN,
LL | |         x if CONST_MAX < x => CONST_MAX,
LL | |         x => x,
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
##[error]  --> tests/ui/manual_clamp.rs:259: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
##[error]  --> tests/ui/manual_clamp.rs:270:19
   |
LL |           let x15 = if input > CONST_F64_MAX {
   |  ___________________^
LL | |
LL | |
LL | |             CONST_F64_MAX
...  |
LL | |             input
LL | |         };
   | |_________^ 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
##[error]  --> tests/ui/manual_clamp.rs:283: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
##[error]  --> tests/ui/manual_clamp.rs:286: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
##[error]  --> tests/ui/manual_clamp.rs:289: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
##[error]  --> tests/ui/manual_clamp.rs:292: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
##[error]  --> tests/ui/manual_clamp.rs:295: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
##[error]  --> tests/ui/manual_clamp.rs:298: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
##[error]  --> tests/ui/manual_clamp.rs:301: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
##[error]  --> tests/ui/manual_clamp.rs:304: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
##[error]  --> tests/ui/manual_clamp.rs:308: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
##[error]  --> tests/ui/manual_clamp.rs:311: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
##[error]  --> tests/ui/manual_clamp.rs:314: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
##[error]  --> tests/ui/manual_clamp.rs:317: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
##[error]  --> tests/ui/manual_clamp.rs:320: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
##[error]  --> tests/ui/manual_clamp.rs:323: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
##[error]  --> tests/ui/manual_clamp.rs:326: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
##[error]  --> tests/ui/manual_clamp.rs:329: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
##[error]  --> tests/ui/manual_clamp.rs:333:5
   |
LL | /     if x32 < CONST_MIN {
LL | |
LL | |
LL | |         x32 = CONST_MIN;
LL | |     } else if x32 > CONST_MAX {
LL | |         x32 = CONST_MAX;
LL | |     }
   | |_____^ help: replace with clamp: `x32 = x32.clamp(CONST_MIN, CONST_MAX);`
   |
   = note: clamp will panic if max < min

error: this match expression is unnecessary
##[error]  --> tests/ui/manual_clamp.rs:408:14
   |
LL |       let x6 = match input {
   |  ______________^
LL | |         x if x < CONST_MAX => x,
LL | |         x if x < CONST_MIN => x,
LL | |         x => x,
LL | |     };
   | |_____^ help: replace it with: `input`
   |
   = note: `-D clippy::needless-match` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_match)]`

error: clamp-like pattern without using clamp function
##[error]  --> tests/ui/manual_clamp.rs:525:13
   |
LL |       let _ = 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: aborting due to 36 previous errors


full stdout:



FAILED TEST: tests/ui/needless_bitwise_bool.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/needless_bitwise_bool.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a9034e1031764ee4.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a9034e1031764ee4.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-49215d6c78da5485.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-49215d6c78da5485.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-647c6467502a5c31.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-647c6467502a5c31.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-e492cfb623514f4f.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-e492cfb623514f4f.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-5c45143607600b30.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-5c45143607600b30.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-6ecd666cd642c024.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-6ecd666cd642c024.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-b4b7e251597dd4a9.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-b4b7e251597dd4a9.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-ba360121f8a9307c.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-ba360121f8a9307c.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-6ddc89563990f085.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-6ddc89563990f085.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/needless_bitwise_bool.stderr` to the actual output
--- tests/ui/needless_bitwise_bool.stderr
+++ <stderr output>
---
-error: aborting due to 1 previous error
+error: use of bitwise operator instead of lazy operator between booleans
+  --> tests/ui/needless_bitwise_bool.rs:37:8
+   |
+LL |     if y & (0 < 1) {
+   |        ^^^^^^^^^^^ help: try: `y && (0 < 1)`
 
+error: aborting due to 2 previous errors
+

Full unnormalized output:
error: use of bitwise operator instead of lazy operator between booleans
##[error]  --> tests/ui/needless_bitwise_bool.rs:23:8
   |
LL |     if y & !x {
   |        ^^^^^^ help: try: `y && !x`
   |
   = note: `-D clippy::needless-bitwise-bool` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_bitwise_bool)]`

error: use of bitwise operator instead of lazy operator between booleans
##[error]  --> tests/ui/needless_bitwise_bool.rs:37:8
   |
LL |     if y & (0 < 1) {
   |        ^^^^^^^^^^^ help: try: `y && (0 < 1)`

error: aborting due to 2 previous errors



error: there was 1 unmatched diagnostic
##[error]  --> tests/ui/needless_bitwise_bool.rs:37:8
   |
37 |     if y & (0 < 1) {
   |        ^^^^^^^^^^^ Error[clippy::needless_bitwise_bool]: use of bitwise operator instead of lazy operator between booleans
   |

full stderr:
error: use of bitwise operator instead of lazy operator between booleans
##[error]  --> tests/ui/needless_bitwise_bool.rs:23:8
   |
LL |     if y & !x {
   |        ^^^^^^ help: try: `y && !x`
   |
   = note: `-D clippy::needless-bitwise-bool` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::needless_bitwise_bool)]`

error: use of bitwise operator instead of lazy operator between booleans
##[error]  --> tests/ui/needless_bitwise_bool.rs:37:8
   |
LL |     if y & (0 < 1) {
   |        ^^^^^^^^^^^ help: try: `y && (0 < 1)`

error: aborting due to 2 previous errors


full stdout:

@Kivooeo
Copy link
Member

Kivooeo commented Dec 26, 2025

Would you like to add a test for this, to reflect new behaviour you changed here

Because on a first glance it's not obvious (at least to me)

@andjsrk
Copy link
Author

andjsrk commented Dec 27, 2025

I'm not sure where should I add a test:

  • tests/ui/expr.rs - Expr::can_have_side_effects is used in a few minor(in my opinion) places and is used widely in Clippy rather than rustc. If I decide to add a test in there, I guess testing code would look pretty unintuitive (could be improved by comments though).
  • compiler/rustc_hir/src/hir/tests.rs - maybe I should add tests here, but I guess runtime test is needed (not just checking successful compilation) and I have no idea about how to create an Expr...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants