summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/bool_to_int_with_if.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/bool_to_int_with_if.rs')
-rw-r--r--src/tools/clippy/tests/ui/bool_to_int_with_if.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/bool_to_int_with_if.rs b/src/tools/clippy/tests/ui/bool_to_int_with_if.rs
index 5d9496f01..ebdf86fd1 100644
--- a/src/tools/clippy/tests/ui/bool_to_int_with_if.rs
+++ b/src/tools/clippy/tests/ui/bool_to_int_with_if.rs
@@ -1,5 +1,6 @@
// run-rustfix
+#![feature(let_chains)]
#![warn(clippy::bool_to_int_with_if)]
#![allow(unused, dead_code, clippy::unnecessary_operation, clippy::no_effect)]
@@ -108,6 +109,8 @@ fn main() {
123
};
+ pub const SHOULD_NOT_LINT: usize = if true { 1 } else { 0 };
+
some_fn(a);
}
@@ -121,3 +124,22 @@ fn side_effect() {}
fn cond(a: bool, b: bool) -> bool {
a || b
}
+
+enum Enum {
+ A,
+ B,
+}
+
+fn if_let(a: Enum, b: Enum) {
+ if let Enum::A = a {
+ 1
+ } else {
+ 0
+ };
+
+ if let Enum::A = a && let Enum::B = b {
+ 1
+ } else {
+ 0
+ };
+}