]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/match_single_binding.fixed
iterate List by value
[rust.git] / tests / ui / match_single_binding.fixed
index bc2346a8dbf0b9b83ff8eea22e518987bfafe9c8..f3627902eec985b15e2e192b0371285fa0848b57 100644 (file)
@@ -12,6 +12,14 @@ fn coords() -> Point {
     Point { x: 1, y: 2 }
 }
 
+macro_rules! foo {
+    ($param:expr) => {
+        match $param {
+            _ => println!("whatever"),
+        }
+    };
+}
+
 fn main() {
     let a = 1;
     let b = 2;
@@ -25,6 +33,8 @@ fn main() {
     let (x, y, z) = (a, b, c);
     println!("{} {} {}", x, y, z);
     // Ok
+    foo!(a);
+    // Ok
     match a {
         2 => println!("2"),
         _ => println!("Not 2"),
@@ -67,4 +77,14 @@ fn main() {
     // Lint
     let Point { x, y } = coords();
     let product = x * y;
+    // Lint
+    let v = vec![Some(1), Some(2), Some(3), Some(4)];
+    #[allow(clippy::let_and_return)]
+    let _ = v
+        .iter()
+        .map(|i| {
+            let unwrapped = i.unwrap();
+            unwrapped
+        })
+        .collect::<Vec<u8>>();
 }