summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/never_loop.stderr
blob: f49b23924efe8b5c52fb807098bf3fd5760c570b (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
error: this loop never actually loops
  --> $DIR/never_loop.rs:10:5
   |
LL | /     loop {
LL | |         // clippy::never_loop
LL | |         x += 1;
LL | |         if x == 1 {
...  |
LL | |         break;
LL | |     }
   | |_____^
   |
   = note: `#[deny(clippy::never_loop)]` on by default

error: this loop never actually loops
  --> $DIR/never_loop.rs:32:5
   |
LL | /     loop {
LL | |         // never loops
LL | |         x += 1;
LL | |         break;
LL | |     }
   | |_____^

error: this loop never actually loops
  --> $DIR/never_loop.rs:52:5
   |
LL | /     loop {
LL | |         // never loops
LL | |         while i == 0 {
LL | |             // never loops
...  |
LL | |         return;
LL | |     }
   | |_____^

error: this loop never actually loops
  --> $DIR/never_loop.rs:54:9
   |
LL | /         while i == 0 {
LL | |             // never loops
LL | |             break;
LL | |         }
   | |_________^

error: this loop never actually loops
  --> $DIR/never_loop.rs:66:9
   |
LL | /         loop {
LL | |             // never loops
LL | |             if x == 5 {
LL | |                 break;
LL | |             }
LL | |             continue 'outer;
LL | |         }
   | |_________^

error: this loop never actually loops
  --> $DIR/never_loop.rs:102:5
   |
LL | /     while let Some(y) = x {
LL | |         // never loops
LL | |         return;
LL | |     }
   | |_____^

error: this loop never actually loops
  --> $DIR/never_loop.rs:109:5
   |
LL | /     for x in 0..10 {
LL | |         // never loops
LL | |         match x {
LL | |             1 => break,
LL | |             _ => return,
LL | |         }
LL | |     }
   | |_____^
   |
help: if you need the first element of the iterator, try writing
   |
LL |     if let Some(x) = (0..10).next() {
   |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

error: this loop never actually loops
  --> $DIR/never_loop.rs:157:5
   |
LL | /     'outer: while a {
LL | |         // never loops
LL | |         while a {
LL | |             if a {
...  |
LL | |         break 'outer;
LL | |     }
   | |_____^

error: this loop never actually loops
  --> $DIR/never_loop.rs:172:9
   |
LL | /         while false {
LL | |             break 'label;
LL | |         }
   | |_________^

error: aborting due to 9 previous errors