]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/collapsible_match.rs
Move MSRV tests into the lint specific test files
[rust.git] / tests / ui / collapsible_match.rs
index 55467cf4229de4b9e5607d003a93f010bfd9eefd..1d7a72846419f48bc3c60990672dc3471a52886b 100644 (file)
@@ -1,5 +1,11 @@
 #![warn(clippy::collapsible_match)]
-#![allow(clippy::needless_return, clippy::no_effect, clippy::single_match)]
+#![allow(
+    clippy::equatable_if_let,
+    clippy::needless_return,
+    clippy::no_effect,
+    clippy::single_match,
+    clippy::uninlined_format_args
+)]
 
 fn lint_cases(opt_opt: Option<Option<u32>>, res_opt: Result<Option<u32>, String>) {
     // match without block
@@ -98,6 +104,11 @@ fn lint_cases(opt_opt: Option<Option<u32>>, res_opt: Result<Option<u32>, String>
 }
 
 fn negative_cases(res_opt: Result<Option<u32>, String>, res_res: Result<Result<u32, String>, String>) {
+    while let Some(x) = make() {
+        if let Some(1) = x {
+            todo!();
+        }
+    }
     // no wild pattern in outer match
     match res_opt {
         Ok(val) => match val {
@@ -242,6 +253,27 @@ enum E<T> {
     };
 }
 
+pub enum Issue9647 {
+    A { a: Option<Option<u8>>, b: () },
+    B,
+}
+
+pub fn test_1(x: Issue9647) {
+    if let Issue9647::A { a, .. } = x {
+        if let Some(u) = a {
+            println!("{u:?}")
+        }
+    }
+}
+
+pub fn test_2(x: Issue9647) {
+    if let Issue9647::A { a: Some(a), .. } = x {
+        if let Some(u) = a {
+            println!("{u}")
+        }
+    }
+}
+
 fn make<T>() -> T {
     unimplemented!()
 }