]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/single_match_else.rs
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / single_match_else.rs
index 82387f3d80b7780a0781dd116dfbbd341d47a3b8..5d03f77e9326e311dceba750ace4662429d4964d 100644 (file)
@@ -1,8 +1,6 @@
 // aux-build: proc_macro_with_span.rs
-
 #![warn(clippy::single_match_else)]
-#![allow(clippy::needless_return)]
-#![allow(clippy::no_effect)]
+#![allow(clippy::needless_return, clippy::no_effect, clippy::uninlined_format_args)]
 
 extern crate proc_macro_with_span;
 use proc_macro_with_span::with_span;
@@ -97,4 +95,23 @@ fn main() {
             return;
         },
     }
+
+    // lint here
+    use std::convert::Infallible;
+    match Result::<i32, Infallible>::Ok(1) {
+        Ok(a) => println!("${:?}", a),
+        Err(_) => {
+            println!("else block");
+            return;
+        }
+    }
+
+    use std::borrow::Cow;
+    match Cow::from("moo") {
+        Cow::Owned(a) => println!("${:?}", a),
+        Cow::Borrowed(_) => {
+            println!("else block");
+            return;
+        }
+    }
 }