]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/tests/ui/single_element_loop.fixed
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / src / tools / clippy / tests / ui / single_element_loop.fixed
index 63d31ff83f9b5c508f09fa556ba5ee2421bd0cc4..a0dcc0172e8b0ba5cba4f7952aad8c521f9023aa 100644 (file)
@@ -33,4 +33,31 @@ fn main() {
         let item = 0..5;
         dbg!(item);
     }
+
+    // should not lint (issue #10018)
+    for e in [42] {
+        if e > 0 {
+            continue;
+        }
+    }
+
+    // should not lint (issue #10018)
+    for e in [42] {
+        if e > 0 {
+            break;
+        }
+    }
+
+    // should lint (issue #10018)
+    {
+        let _ = 42;
+        let _f = |n: u32| {
+            for i in 0..n {
+                if i > 10 {
+                    dbg!(i);
+                    break;
+                }
+            }
+        };
+    }
 }