mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
35 lines
708 B
Text
35 lines
708 B
Text
error: for loop over a single element
|
|
--> $DIR/single_element_loop.rs:7:5
|
|
|
|
|
LL | / for item in &[item1] {
|
|
LL | | println!("{}", item);
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
= note: `-D clippy::single-element-loop` implied by `-D warnings`
|
|
help: try
|
|
|
|
|
LL ~ {
|
|
LL + let item = &item1;
|
|
LL + println!("{}", item);
|
|
LL + }
|
|
|
|
|
|
|
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
|
|
|