]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/question_mark.rs
Move MSRV tests into the lint specific test files
[rust.git] / tests / ui / question_mark.rs
index cdbc7b1606f80782c7d107e213311e4b79cb6769..9ae0d88829af55cb91d387cadd0bc84a83a119e8 100644 (file)
@@ -243,4 +243,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(())
+}