]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/tests/ui/single_element_loop.stderr
Rollup merge of #84221 - ABouttefeux:generic-arg-elision, r=estebank
[rust.git] / src / tools / clippy / tests / ui / single_element_loop.stderr
index 90be1dc328371f6bc611cc236bd14b31f600d6e1..0e35a33ded5ba0fc34a7aeaf46623630b74aaaa9 100644 (file)
@@ -15,5 +15,21 @@ LL |         println!("{}", item);
 LL |     }
    |
 
-error: aborting due to previous error
+error: for loop over a single element
+  --> $DIR/single_element_loop.rs:11:5
+   |
+LL | /     for item in [item1].iter() {
+LL | |         println!("{:?}", item);
+LL | |     }
+   | |_____^
+   |
+help: try
+   |
+LL |     {
+LL |         let item = &item1;
+LL |         println!("{:?}", item);
+LL |     }
+   |
+
+error: aborting due to 2 previous errors