]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/manual_unwrap_or.rs
fix invalid code suggestion in `manual_unwrap_or`, due to macro expansion
[rust.git] / tests / ui / manual_unwrap_or.rs
index 1088047da75b872b05ea9deaddf15f7b969cd850..66006b6c616f08f9e1858e53ef451b57b26c130f 100644 (file)
@@ -176,18 +176,33 @@ fn method(self) -> Option<i32> {
 }
 
 // don't lint in const fn
-const fn const_fn_unwrap_or() {
+const fn const_fn_option_unwrap_or() {
     match Some(1) {
         Some(s) => s,
         None => 0,
     };
 }
 
-const fn const_fn_unwrap() {
+const fn const_fn_result_unwrap_or() {
     match Ok::<&str, &str>("Alice") {
         Ok(s) => s,
         Err(_) => "Bob",
     };
 }
 
+mod issue6965 {
+    macro_rules! some_macro {
+        () => {
+            if 1 > 2 { Some(1) } else { None }
+        };
+    }
+
+    fn test() {
+        let _ = match some_macro!() {
+            Some(val) => val,
+            None => 0,
+        };
+    }
+}
+
 fn main() {}