]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/manual_map_option.rs
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / manual_map_option.rs
index 1ccb450619c69127897206289409c6fd2b32d5b4..325a6db06c4e53a533348d41462e81dff808e09d 100644 (file)
@@ -1,4 +1,3 @@
-// edition:2018
 // run-rustfix
 
 #![warn(clippy::manual_map)]
@@ -7,6 +6,8 @@
     clippy::map_identity,
     clippy::unit_arg,
     clippy::match_ref_pats,
+    clippy::redundant_pattern_matching,
+    for_loops_over_fallibles,
     dead_code
 )]
 
@@ -186,4 +187,37 @@ async fn f3() {
             None => None,
         };
     }
+
+    // #6847
+    if let Some(_) = Some(0) {
+        Some(0)
+    } else if let Some(x) = Some(0) {
+        Some(x + 1)
+    } else {
+        None
+    };
+
+    if true {
+        Some(0)
+    } else if let Some(x) = Some(0) {
+        Some(x + 1)
+    } else {
+        None
+    };
+
+    // #6967
+    const fn f4() {
+        match Some(0) {
+            Some(x) => Some(x + 1),
+            None => None,
+        };
+    }
+
+    // #7077
+    let s = &String::new();
+    #[allow(clippy::needless_match)]
+    let _: Option<&str> = match Some(s) {
+        Some(s) => Some(s),
+        None => None,
+    };
 }