]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/manual_map_option.rs
Addition `manual_map` test for `unsafe` blocks
[rust.git] / tests / ui / manual_map_option.rs
index 3299e6177074c7cdefbb3c804ea7ef13a0043956..d11bf5ecb825ae28a1ae76ba6f1594199e37dfc8 100644 (file)
@@ -1,4 +1,3 @@
-// edition:2018
 // run-rustfix
 
 #![warn(clippy::manual_map)]
@@ -7,6 +6,7 @@
     clippy::map_identity,
     clippy::unit_arg,
     clippy::match_ref_pats,
+    clippy::redundant_pattern_matching,
     dead_code
 )]
 
@@ -195,4 +195,27 @@ async fn f3() {
     } 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();
+    let _: Option<&str> = match Some(s) {
+        Some(s) => Some(s),
+        None => None,
+    };
 }