@@ -7,6 +7,7 @@ LL | | do_something();
77LL | | }
88 | |_____^
99 |
10+ = help: if this is not intended, try adding a `break` or `return` to the loop
1011 = note: `-D clippy::infinite-loop` implied by `-D warnings`
1112 = help: to override `-D warnings` add `#[allow(clippy::infinite_loop)]`
1213help: if this is intentional, consider specifying `!` as function return
@@ -25,6 +26,7 @@ LL | | do_something();
2526LL | | }
2627 | |_____^
2728 |
29+ = help: if this is not intended, try adding a `break` or `return` to the loop
2830help: if this is intentional, consider specifying `!` as function return
2931 |
3032LL | fn all_inf() -> ! {
@@ -40,6 +42,7 @@ LL | | loop {
4042LL | | }
4143 | |_________^
4244 |
45+ = help: if this is not intended, try adding a `break` or `return` to the loop
4346help: if this is intentional, consider specifying `!` as function return
4447 |
4548LL | fn all_inf() -> ! {
@@ -54,6 +57,7 @@ LL | | do_something();
5457LL | | }
5558 | |_____________^
5659 |
60+ = help: if this is not intended, try adding a `break` or `return` to the loop
5761help: if this is intentional, consider specifying `!` as function return
5862 |
5963LL | fn all_inf() -> ! {
@@ -68,7 +72,7 @@ LL | | do_something();
6872LL | | }
6973 | |_____^
7074 |
71- = help: if this is not intended, try adding a `break` or `return` condition in the loop
75+ = help: if this is not intended, try adding a `break` or `return` to the loop
7276
7377error: infinite loop detected
7478 --> tests/ui/infinite_loops.rs:51:5
@@ -82,6 +86,7 @@ LL | | do_something();
8286LL | | }
8387 | |_____^
8488 |
89+ = help: if this is not intended, try adding a `break` or `return` to the loop
8590help: if this is intentional, consider specifying `!` as function return
8691 |
8792LL | fn no_break_never_ret_noise() -> ! {
@@ -98,6 +103,7 @@ LL | | if cond {
98103LL | | }
99104 | |_____^
100105 |
106+ = help: if this is not intended, try adding a `break` or `return` to the loop
101107help: if this is intentional, consider specifying `!` as function return
102108 |
103109LL | fn break_inner_but_not_outer_1(cond: bool) -> ! {
@@ -114,6 +120,7 @@ LL | | loop {
114120LL | | }
115121 | |_____^
116122 |
123+ = help: if this is not intended, try adding a `break` or `return` to the loop
117124help: if this is intentional, consider specifying `!` as function return
118125 |
119126LL | fn break_inner_but_not_outer_2(cond: bool) -> ! {
@@ -128,10 +135,7 @@ LL | | do_something();
128135LL | | }
129136 | |_________^
130137 |
131- help: if this is intentional, consider specifying `!` as function return
132- |
133- LL | fn break_outer_but_not_inner() -> ! {
134- | ++++
138+ = help: if this is not intended, try adding a `break` or `return` to the loop
135139
136140error: infinite loop detected
137141 --> tests/ui/infinite_loops.rs:143:9
@@ -144,10 +148,7 @@ LL | | loop {
144148LL | | }
145149 | |_________^
146150 |
147- help: if this is intentional, consider specifying `!` as function return
148- |
149- LL | fn break_wrong_loop(cond: bool) -> ! {
150- | ++++
151+ = help: if this is not intended, try adding a `break` or `return` to the loop
151152
152153error: infinite loop detected
153154 --> tests/ui/infinite_loops.rs:183:5
@@ -160,10 +161,7 @@ LL | | Some(v) => {
160161LL | | }
161162 | |_____^
162163 |
163- help: if this is intentional, consider specifying `!` as function return
164- |
165- LL | fn match_like() -> ! {
166- | ++++
164+ = help: if this is not intended, try adding a `break` or `return` to the loop
167165
168166error: infinite loop detected
169167 --> tests/ui/infinite_loops.rs:224:5
@@ -174,10 +172,7 @@ LL | | let _x = matches!(result, Ok(v) if v != 0).then_some(0);
174172LL | | }
175173 | |_____^
176174 |
177- help: if this is intentional, consider specifying `!` as function return
178- |
179- LL | fn match_like() -> ! {
180- | ++++
175+ = help: if this is not intended, try adding a `break` or `return` to the loop
181176
182177error: infinite loop detected
183178 --> tests/ui/infinite_loops.rs:229:5
@@ -191,10 +186,7 @@ LL | | });
191186LL | | }
192187 | |_____^
193188 |
194- help: if this is intentional, consider specifying `!` as function return
195- |
196- LL | fn match_like() -> ! {
197- | ++++
189+ = help: if this is not intended, try adding a `break` or `return` to the loop
198190
199191error: infinite loop detected
200192 --> tests/ui/infinite_loops.rs:334:9
@@ -205,6 +197,7 @@ LL | | do_something();
205197LL | | }
206198 | |_________^
207199 |
200+ = help: if this is not intended, try adding a `break` or `return` to the loop
208201help: if this is intentional, consider specifying `!` as function return
209202 |
210203LL | fn problematic_trait_method() -> ! {
@@ -219,6 +212,7 @@ LL | | do_something();
219212LL | | }
220213 | |_________^
221214 |
215+ = help: if this is not intended, try adding a `break` or `return` to the loop
222216help: if this is intentional, consider specifying `!` as function return
223217 |
224218LL | fn could_be_problematic() -> ! {
@@ -233,6 +227,7 @@ LL | | do_something();
233227LL | | }
234228 | |_________^
235229 |
230+ = help: if this is not intended, try adding a `break` or `return` to the loop
236231help: if this is intentional, consider specifying `!` as function return
237232 |
238233LL | let _loop_forever = || -> ! {
@@ -248,7 +243,7 @@ LL | | do_something()
248243LL | | })
249244 | |_____^
250245 |
251- = help: if this is not intended, try adding a `break` or `return` condition in the loop
246+ = help: if this is not intended, try adding a `break` or `return` to the loop
252247
253248error: infinite loop detected
254249 --> tests/ui/infinite_loops.rs:410:5
@@ -261,6 +256,7 @@ LL | | }
261256LL | | }
262257 | |_____^
263258 |
259+ = help: if this is not intended, try adding a `break` or `return` to the loop
264260help: if this is intentional, consider specifying `!` as function return
265261 |
266262LL | fn continue_outer() -> ! {
@@ -276,6 +272,7 @@ LL | | 'inner: loop {
276272LL | | }
277273 | |_____^
278274 |
275+ = help: if this is not intended, try adding a `break` or `return` to the loop
279276help: if this is intentional, consider specifying `!` as function return
280277 |
281278LL | fn continue_outer() -> ! {
@@ -292,6 +289,7 @@ LL | | }
292289LL | | }
293290 | |_________^
294291 |
292+ = help: if this is not intended, try adding a `break` or `return` to the loop
295293help: if this is intentional, consider specifying `!` as function return
296294 |
297295LL | fn continue_outer() -> ! {
@@ -306,6 +304,7 @@ LL | | continue;
306304LL | | }
307305 | |_____^
308306 |
307+ = help: if this is not intended, try adding a `break` or `return` to the loop
309308help: if this is intentional, consider specifying `!` as function return
310309 |
311310LL | fn continue_outer() -> ! {
@@ -320,7 +319,7 @@ LL | | do_something();
320319LL | | }
321320 | |_____________^
322321 |
323- = help: if this is not intended, try adding a `break` or `return` condition in the loop
322+ = help: if this is not intended, try adding a `break` or `return` to the loop
324323
325324error: infinite loop detected
326325 --> tests/ui/infinite_loops.rs:466:13
@@ -331,7 +330,7 @@ LL | | continue;
331330LL | | }
332331 | |_____________^
333332 |
334- = help: if this is not intended, try adding a `break` or `return` condition in the loop
333+ = help: if this is not intended, try adding a `break` or `return` to the loop
335334
336335error: infinite loop detected
337336 --> tests/ui/infinite_loops.rs:533:9
@@ -341,7 +340,87 @@ LL | | std::future::pending().await
341340LL | | }
342341 | |_________^
343342 |
344- = help: if this is not intended, try adding a `break` or `return` condition in the loop
343+ = help: if this is not intended, try adding a `break` or `return` to the loop
344+
345+ error: infinite loop detected
346+ --> tests/ui/infinite_loops.rs:545:32
347+ |
348+ LL | let true = cond else { loop {} };
349+ | ^^^^^^^
350+ |
351+ = help: if this is not intended, try adding a `break` or `return` to the loop
352+
353+ error: infinite loop detected
354+ --> tests/ui/infinite_loops.rs:551:13
355+ |
356+ LL | loop {}
357+ | ^^^^^^^
358+ |
359+ = help: if this is not intended, try adding a `break` or `return` to the loop
360+
361+ error: infinite loop detected
362+ --> tests/ui/infinite_loops.rs:559:21
363+ |
364+ LL | None => loop {},
365+ | ^^^^^^^
366+ |
367+ = help: if this is not intended, try adding a `break` or `return` to the loop
368+
369+ error: infinite loop detected
370+ --> tests/ui/infinite_loops.rs:568:13
371+ |
372+ LL | loop {}
373+ | ^^^^^^^
374+ |
375+ = help: if this is not intended, try adding a `break` or `return` to the loop
376+
377+ error: infinite loop detected
378+ --> tests/ui/infinite_loops.rs:576:13
379+ |
380+ LL | loop {}
381+ | ^^^^^^^
382+ |
383+ = help: if this is not intended, try adding a `break` or `return` to the loop
384+ help: if this is intentional, consider specifying `!` as function return
385+ |
386+ LL | fn all_branches_diverge_if(cond: bool) -> ! {
387+ | ++++
388+
389+ error: infinite loop detected
390+ --> tests/ui/infinite_loops.rs:579:13
391+ |
392+ LL | loop {}
393+ | ^^^^^^^
394+ |
395+ = help: if this is not intended, try adding a `break` or `return` to the loop
396+ help: if this is intentional, consider specifying `!` as function return
397+ |
398+ LL | fn all_branches_diverge_if(cond: bool) -> ! {
399+ | ++++
400+
401+ error: infinite loop detected
402+ --> tests/ui/infinite_loops.rs:586:24
403+ |
404+ LL | Some(_) => loop {},
405+ | ^^^^^^^
406+ |
407+ = help: if this is not intended, try adding a `break` or `return` to the loop
408+ help: if this is intentional, consider specifying `!` as function return
409+ |
410+ LL | fn all_branches_diverge_match(x: Option<i32>) -> ! {
411+ | ++++
412+
413+ error: infinite loop detected
414+ --> tests/ui/infinite_loops.rs:587:21
415+ |
416+ LL | None => loop {},
417+ | ^^^^^^^
418+ |
419+ = help: if this is not intended, try adding a `break` or `return` to the loop
420+ help: if this is intentional, consider specifying `!` as function return
421+ |
422+ LL | fn all_branches_diverge_match(x: Option<i32>) -> ! {
423+ | ++++
345424
346- error: aborting due to 24 previous errors
425+ error: aborting due to 32 previous errors
347426
0 commit comments