summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/question_mark.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/question_mark.rs')
-rw-r--r--src/tools/clippy/tests/ui/question_mark.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/question_mark.rs b/src/tools/clippy/tests/ui/question_mark.rs
index cdbc7b160..9ae0d8882 100644
--- a/src/tools/clippy/tests/ui/question_mark.rs
+++ b/src/tools/clippy/tests/ui/question_mark.rs
@@ -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(())
+}