about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/never_loop_fixable.stderr
blob: ee02d9a4297605f033236c9fb70a4927c374e6ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
error: this loop never actually loops
  --> tests/ui/never_loop_fixable.rs:4:5
   |
LL | /     for i in [1, 2, 3].iter() {
LL | |
LL | |         return;
LL | |     }
   | |_____^
   |
   = note: `#[deny(clippy::never_loop)]` on by default
help: if you need the first element of the iterator, try writing
   |
LL -     for i in [1, 2, 3].iter() {
LL +     if let Some(i) = [1, 2, 3].iter().next() {
   |

error: this loop never actually loops
  --> tests/ui/never_loop_fixable.rs:11:5
   |
LL | /     for i in [1, 2, 3].iter() {
LL | |
LL | |         return;
LL | |         loop {
...  |
LL | |     }
   | |_____^
   |
help: if you need the first element of the iterator, try writing
   |
LL -     for i in [1, 2, 3].iter() {
LL +     if let Some(i) = [1, 2, 3].iter().next() {
   |

error: aborting due to 2 previous errors