]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/redundant_pattern_matching.fixed
Forbid redundant_pattern_matching triggering in macros
[rust.git] / tests / ui / redundant_pattern_matching.fixed
index 17d908336d5934f7418020ee19fd244e02256198..fe8f62503b76748685eb4df7ca893a038ac65e2f 100644 (file)
@@ -42,6 +42,7 @@ fn main() {
 
     issue5504();
     issue6067();
+    issue6065();
 
     let _ = if gen_res().is_ok() {
         1
@@ -79,6 +80,17 @@ fn issue5504() {
     while m!().is_some() {}
 }
 
+fn issue6065() {
+    macro_rules! if_let_in_macro {
+        ($pat:pat, $x:expr) => {
+            if let Some($pat) = $x {}
+        };
+    }
+
+    // shouldn't be linted
+    if_let_in_macro!(_, Some(42));
+}
+
 // Methods that are unstable const should not be suggested within a const context, see issue #5697.
 // However, in Rust 1.48.0 the methods `is_ok` and `is_err` of `Result` were stabilized as const,
 // so the following should be linted.