]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/question_mark.fixed
Move MSRV tests into the lint specific test files
[rust.git] / tests / ui / question_mark.fixed
index c4c9c82143336647e2dafb04292544c81797c6d5..993389232cc2955fc79bff5a28d0bdc0b0a8d57c 100644 (file)
@@ -207,4 +207,28 @@ fn option_map() -> Option<bool> {
     }
 }
 
+pub struct PatternedError {
+    flag: bool,
+}
+
+// No warning
+fn pattern() -> Result<(), PatternedError> {
+    let res = Ok(());
+
+    if let Err(err @ PatternedError { flag: true }) = res {
+        return Err(err);
+    }
+
+    res
+}
+
 fn main() {}
+
+// should not lint, `?` operator not available in const context
+const fn issue9175(option: Option<()>) -> Option<()> {
+    if option.is_none() {
+        return None;
+    }
+    //stuff
+    Some(())
+}