]> git.lizzy.rs Git - rust.git/blob - tests/ui/single_element_loop.stderr
Don't lint `if_same_then_else` with `if let` conditions
[rust.git] / tests / ui / single_element_loop.stderr
1 error: for loop over a single element
2   --> $DIR/single_element_loop.rs:7:5
3    |
4 LL | /     for item in &[item1] {
5 LL | |         println!("{}", item);
6 LL | |     }
7    | |_____^
8    |
9    = note: `-D clippy::single-element-loop` implied by `-D warnings`
10 help: try
11    |
12 LL ~     {
13 LL +         let item = &item1;
14 LL +         println!("{}", item);
15 LL +     }
16    |
17
18 error: for loop over a single element
19   --> $DIR/single_element_loop.rs:11:5
20    |
21 LL | /     for item in [item1].iter() {
22 LL | |         println!("{:?}", item);
23 LL | |     }
24    | |_____^
25    |
26 help: try
27    |
28 LL ~     {
29 LL +         let item = &item1;
30 LL +         println!("{:?}", item);
31 LL +     }
32    |
33
34 error: aborting due to 2 previous errors
35