]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/implicit_return.rs
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / implicit_return.rs
index 73cf2908833cd71cbf2c7656b96a916239d527c6..46ead9bf0c578f019ec1af5affff38d9f3305e03 100644 (file)
@@ -7,10 +7,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-
-
-
 #![warn(clippy::implicit_return)]
 
 fn test_end_of_fn() -> bool {
@@ -31,12 +27,11 @@ fn test_if_block() -> bool {
 }
 
 #[allow(clippy::match_bool)]
+#[rustfmt::skip]
 fn test_match(x: bool) -> bool {
     match x {
         true => false,
-        false => {
-            true
-        }
+        false => { true },
     }
 }
 
@@ -47,10 +42,29 @@ fn test_loop() -> bool {
     }
 }
 
+#[allow(clippy::never_loop)]
+fn test_loop_with_block() -> bool {
+    loop {
+        {
+            break true;
+        }
+    }
+}
+
+#[allow(clippy::never_loop)]
+fn test_loop_with_nests() -> bool {
+    loop {
+        if true {
+            break true;
+        } else {
+            let _ = true;
+        }
+    }
+}
+
 fn test_closure() {
-    let _ = || {
-        true
-    };
+    #[rustfmt::skip]
+    let _ = || { true };
     let _ = || true;
 }
 
@@ -59,5 +73,7 @@ fn main() {
     let _ = test_if_block();
     let _ = test_match(true);
     let _ = test_loop();
+    let _ = test_loop_with_block();
+    let _ = test_loop_with_nests();
     test_closure();
 }