summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/bool_to_int_with_if.stderr
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/bool_to_int_with_if.stderr')
-rw-r--r--src/tools/clippy/tests/ui/bool_to_int_with_if.stderr84
1 files changed, 84 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/bool_to_int_with_if.stderr b/src/tools/clippy/tests/ui/bool_to_int_with_if.stderr
new file mode 100644
index 000000000..8647a9cff
--- /dev/null
+++ b/src/tools/clippy/tests/ui/bool_to_int_with_if.stderr
@@ -0,0 +1,84 @@
+error: boolean to int conversion using if
+ --> $DIR/bool_to_int_with_if.rs:15:5
+ |
+LL | / if a {
+LL | | 1
+LL | | } else {
+LL | | 0
+LL | | };
+ | |_____^ help: replace with from: `i32::from(a)`
+ |
+ = note: `-D clippy::bool-to-int-with-if` implied by `-D warnings`
+ = note: `a as i32` or `a.into()` can also be valid options
+
+error: boolean to int conversion using if
+ --> $DIR/bool_to_int_with_if.rs:20:5
+ |
+LL | / if !a {
+LL | | 1
+LL | | } else {
+LL | | 0
+LL | | };
+ | |_____^ help: replace with from: `i32::from(!a)`
+ |
+ = note: `!a as i32` or `!a.into()` can also be valid options
+
+error: boolean to int conversion using if
+ --> $DIR/bool_to_int_with_if.rs:25:5
+ |
+LL | / if a || b {
+LL | | 1
+LL | | } else {
+LL | | 0
+LL | | };
+ | |_____^ help: replace with from: `i32::from(a || b)`
+ |
+ = note: `(a || b) as i32` or `(a || b).into()` can also be valid options
+
+error: boolean to int conversion using if
+ --> $DIR/bool_to_int_with_if.rs:30:5
+ |
+LL | / if cond(a, b) {
+LL | | 1
+LL | | } else {
+LL | | 0
+LL | | };
+ | |_____^ help: replace with from: `i32::from(cond(a, b))`
+ |
+ = note: `cond(a, b) as i32` or `cond(a, b).into()` can also be valid options
+
+error: boolean to int conversion using if
+ --> $DIR/bool_to_int_with_if.rs:35:5
+ |
+LL | / if x + y < 4 {
+LL | | 1
+LL | | } else {
+LL | | 0
+LL | | };
+ | |_____^ help: replace with from: `i32::from(x + y < 4)`
+ |
+ = note: `(x + y < 4) as i32` or `(x + y < 4).into()` can also be valid options
+
+error: boolean to int conversion using if
+ --> $DIR/bool_to_int_with_if.rs:44:12
+ |
+LL | } else if b {
+ | ____________^
+LL | | 1
+LL | | } else {
+LL | | 0
+LL | | };
+ | |_____^ help: replace with from: `{i32::from(b)}`
+ |
+ = note: `b as i32` or `b.into()` can also be valid options
+
+error: boolean to int conversion using if
+ --> $DIR/bool_to_int_with_if.rs:102:5
+ |
+LL | if a { 1 } else { 0 }
+ | ^^^^^^^^^^^^^^^^^^^^^ help: replace with from: `u8::from(a)`
+ |
+ = note: `a as u8` or `a.into()` can also be valid options
+
+error: aborting due to 7 previous errors
+