]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/tests/ui/for_loops_over_fallibles.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / for_loops_over_fallibles.rs
index 1b9dde87cd5a2ab05460badc2374fc5d947449cf..3390111d0a8fe19e758914ab51f27ab31b81e407 100644 (file)
@@ -2,7 +2,7 @@
 
 fn for_loops_over_fallibles() {
     let option = Some(1);
-    let result = option.ok_or("x not found");
+    let mut result = option.ok_or("x not found");
     let v = vec![0, 1, 2];
 
     // check over an `Option`
@@ -10,11 +10,26 @@ fn for_loops_over_fallibles() {
         println!("{}", x);
     }
 
+    // check over an `Option`
+    for x in option.iter() {
+        println!("{}", x);
+    }
+
     // check over a `Result`
     for x in result {
         println!("{}", x);
     }
 
+    // check over a `Result`
+    for x in result.iter_mut() {
+        println!("{}", x);
+    }
+
+    // check over a `Result`
+    for x in result.into_iter() {
+        println!("{}", x);
+    }
+
     for x in option.ok_or("x not found") {
         println!("{}", x);
     }