Skip to content

Commit

Permalink
Ignore bool_to_int_with_if clippy lint in test suite
Browse files Browse the repository at this point in the history
    error: boolean to int conversion using if
       --> tests/test_ensure.rs:620:30
        |
    620 |     let test = || Ok(ensure!(if let ref mut _x @ 0 = 0 { 0 } else { 1 } == 1));
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `i32::from(!(let ref mut _x @ 0 = 0))`
        |
        = note: `-D clippy::bool-to-int-with-if` implied by `-D clippy::all`
        = note: `!(let ref mut _x @ 0 = 0) as i32` or `(!(let ref mut _x @ 0 = 0)).into()` can also be valid options
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

    error: boolean to int conversion using if
       --> tests/test_ensure.rs:626:30
        |
    626 |     let test = || Ok(ensure!(if let -1..=1 = 0 { 0 } else { 1 } == 1));
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `i32::from(!(let -1..=1 = 0))`
        |
        = note: `!(let -1..=1 = 0) as i32` or `(!(let -1..=1 = 0)).into()` can also be valid options
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

    error: boolean to int conversion using if
       --> tests/test_ensure.rs:632:30
        |
    632 |     let test = || Ok(ensure!(if let &0 = &0 { 0 } else { 1 } == 1));
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `i32::from(!($lit))`
        |
        = note: `!($lit) as i32` or `(!($lit)).into()` can also be valid options
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

    error: boolean to int conversion using if
       --> tests/test_ensure.rs:638:30
        |
    638 |     let test = || Ok(ensure!(if let &&0 = &&0 { 0 } else { 1 } == 1));
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `i32::from(!($lit))`
        |
        = note: `!($lit) as i32` or `(!($lit)).into()` can also be valid options
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

    error: boolean to int conversion using if
       --> tests/test_ensure.rs:644:30
        |
    644 |     let test = || Ok(ensure!(if let &mut 0 = &mut 0 { 0 } else { 1 } == 1));
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `i32::from(!($lit))`
        |
        = note: `!($lit) as i32` or `(!($lit)).into()` can also be valid options
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

    error: boolean to int conversion using if
       --> tests/test_ensure.rs:650:30
        |
    650 |     let test = || Ok(ensure!(if let &&mut 0 = &&mut 0 { 0 } else { 1 } == 1));
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `i32::from(!($lit))`
        |
        = note: `!($lit) as i32` or `(!($lit)).into()` can also be valid options
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

    error: boolean to int conversion using if
       --> tests/test_ensure.rs:656:30
        |
    656 |     let test = || Ok(ensure!(if let (0, 1) = (0, 1) { 0 } else { 1 } == 1));
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `i32::from(!(let (0, 1) = (0, 1)))`
        |
        = note: `!(let (0, 1) = (0, 1)) as i32` or `(!(let (0, 1) = (0, 1))).into()` can also be valid options
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

    error: boolean to int conversion using if
       --> tests/test_ensure.rs:662:30
        |
    662 |     let test = || Ok(ensure!(if let [0] = b"\0" { 0 } else { 1 } == 1));
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `i32::from(!(let [0] = b"\0"))`
        |
        = note: `!(let [0] = b"\0") as i32` or `(!(let [0] = b"\0")).into()` can also be valid options
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

    error: boolean to int conversion using if
       --> tests/test_ensure.rs:669:30
        |
    669 |     let test = || Ok(ensure!(if let P::<u8> {} = p { 0 } else { 1 } == 1));
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `i32::from(!($ident))`
        |
        = note: `!($ident) as i32` or `(!($ident)).into()` can also be valid options
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

    error: boolean to int conversion using if
       --> tests/test_ensure.rs:681:30
        |
    681 |     let test = || Ok(ensure!(if let <S as Trait>::V = 0 { 0 } else { 1 } == 1));
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `i32::from(!(let <S as Trait>::V = 0))`
        |
        = note: `!(let <S as Trait>::V = 0) as i32` or `(!(let <S as Trait>::V = 0)).into()` can also be valid options
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

    error: boolean to int conversion using if
       --> tests/test_ensure.rs:693:30
        |
    693 |     let test = || Ok(ensure!(if let stringify!(x) = "x" { 0 } else { 1 } == 1));
        |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `i32::from(!(let stringify!(x) = "x"))`
        |
        = note: `!(let stringify!(x) = "x") as i32` or `(!(let stringify!(x) = "x")).into()` can also be valid options
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if
  • Loading branch information
dtolnay committed Sep 23, 2022
1 parent 94ae34b commit 7b171d6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tests/test_ensure.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(
clippy::bool_to_int_with_if,
clippy::diverging_sub_expression,
clippy::if_same_then_else,
clippy::ifs_same_cond,
Expand Down

0 comments on commit 7b171d6

Please sign in to comment.