]> git.lizzy.rs Git - rust.git/blob - tests/ui/while_loop.stderr
Merge pull request #1692 from Manishearth/tests
[rust.git] / tests / ui / while_loop.stderr
1 error: this loop could be written as a `while let` loop
2   --> $DIR/while_loop.rs:9:5
3    |
4 9  | /     loop {
5 10 | |
6 11 | |
7 12 | |
8 ...  |
9 17 | |         }
10 18 | |     }
11    | |_____^
12    |
13 note: lint level defined here
14   --> $DIR/while_loop.rs:4:9
15    |
16 4  | #![deny(while_let_loop, empty_loop, while_let_on_iterator)]
17    |         ^^^^^^^^^^^^^^
18 help: try
19    |     while let Some(_x) = y { .. }
20
21 error: this loop could be written as a `while let` loop
22   --> $DIR/while_loop.rs:25:5
23    |
24 25 | /     loop {
25 26 | |
26 27 | |
27 28 | |
28 ...  |
29 32 | |         };
30 33 | |     }
31    | |_____^
32    |
33 help: try
34    |     while let Some(_x) = y { .. }
35
36 error: this loop could be written as a `while let` loop
37   --> $DIR/while_loop.rs:34:5
38    |
39 34 | /     loop {
40 35 | |
41 36 | |
42 37 | |
43 ...  |
44 43 | |         let _str = "foo";
45 44 | |     }
46    | |_____^
47    |
48 help: try
49    |     while let Some(x) = y { .. }
50
51 error: this loop could be written as a `while let` loop
52   --> $DIR/while_loop.rs:45:5
53    |
54 45 | /     loop {
55 46 | |
56 47 | |
57 48 | |
58 ...  |
59 54 | |         { let _b = "foobar"; }
60 55 | |     }
61    | |_____^
62    |
63 help: try
64    |     while let Some(x) = y { .. }
65
66 error: this loop could be written as a `while let` loop
67   --> $DIR/while_loop.rs:70:5
68    |
69 70 | /     loop {
70 71 | |
71 72 | |
72 73 | |
73 ...  |
74 79 | |         let _ = (e, l);
75 80 | |     }
76    | |_____^
77    |
78 help: try
79    |     while let Some(word) = "".split_whitespace().next() { .. }
80
81 error: this loop could be written as a `for` loop
82   --> $DIR/while_loop.rs:83:5
83    |
84 83 | /     while let Option::Some(x) = iter.next() {
85 84 | |
86 85 | |
87 86 | |
88 87 | |         println!("{}", x);
89 88 | |     }
90    | |_____^
91    |
92 note: lint level defined here
93   --> $DIR/while_loop.rs:4:37
94    |
95 4  | #![deny(while_let_loop, empty_loop, while_let_on_iterator)]
96    |                                     ^^^^^^^^^^^^^^^^^^^^^
97 help: try
98    |     for x in iter { .. }
99
100 error: this loop could be written as a `for` loop
101   --> $DIR/while_loop.rs:91:5
102    |
103 91 | /     while let Some(x) = iter.next() {
104 92 | |
105 93 | |
106 94 | |
107 95 | |         println!("{}", x);
108 96 | |     }
109    | |_____^
110    |
111 help: try
112    |     for x in iter { .. }
113
114 error: this loop could be written as a `for` loop
115   --> $DIR/while_loop.rs:99:5
116    |
117 99 |     while let Some(_) = iter.next() {}
118    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
119    |
120 help: try
121    |     for _ in iter { .. }
122
123 error: this loop could be written as a `while let` loop
124    --> $DIR/while_loop.rs:142:5
125     |
126 142 | /     loop {
127 143 | |
128 144 | |
129 145 | |
130 ...   |
131 150 | |         loop {}
132 151 | |     }
133     | |_____^
134     |
135 help: try
136     |     while let Some(ele) = iter.next() { .. }
137
138 error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body.
139    --> $DIR/while_loop.rs:150:9
140     |
141 150 |         loop {}
142     |         ^^^^^^^
143     |
144 note: lint level defined here
145    --> $DIR/while_loop.rs:4:25
146     |
147 4   | #![deny(while_let_loop, empty_loop, while_let_on_iterator)]
148     |                         ^^^^^^^^^^
149
150 error: aborting due to 10 previous errors
151