]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/match_single_binding2.rs
Fix `unnecessary_cast` suggestion when taking a reference
[rust.git] / tests / ui / match_single_binding2.rs
index 7362cb390e5e8ad44539d29ff6ebb3503fe7c72e..5a4bb8441fffc5676422e282c922adbcad7ee180 100644 (file)
@@ -1,7 +1,7 @@
 // run-rustfix
-
 #![warn(clippy::match_single_binding)]
 #![allow(unused_variables)]
+#![allow(clippy::uninlined_format_args)]
 
 fn main() {
     // Lint (additional curly braces needed, see #6572)
@@ -34,4 +34,22 @@ fn size_hint<I: Iterator>(iter: &AppendIter<I>) -> (usize, Option<usize>) {
         },
         None => println!("nothing"),
     }
+
+    fn side_effects() {}
+
+    // Lint (scrutinee has side effects)
+    // issue #7094
+    match side_effects() {
+        _ => println!("Side effects"),
+    }
+
+    // Lint (scrutinee has side effects)
+    // issue #7094
+    let x = 1;
+    match match x {
+        0 => 1,
+        _ => 2,
+    } {
+        _ => println!("Single branch"),
+    }
 }