2017-02-17 03:53:14 +00:00
|
|
|
error: this loop never actually loops
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:12:5
|
2017-02-17 03:53:14 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / loop {
|
|
|
|
LL | | // clippy::never_loop
|
|
|
|
LL | | x += 1;
|
|
|
|
LL | | if x == 1 {
|
2018-12-10 05:27:19 +00:00
|
|
|
... |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | break;
|
|
|
|
LL | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-17 03:53:14 +00:00
|
|
|
|
|
2019-07-18 22:35:32 +00:00
|
|
|
= note: `#[deny(clippy::never_loop)]` on by default
|
2017-02-17 03:53:14 +00:00
|
|
|
|
|
|
|
error: this loop never actually loops
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:34:5
|
2017-02-17 03:53:14 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / loop {
|
|
|
|
LL | | // never loops
|
|
|
|
LL | | x += 1;
|
|
|
|
LL | | break;
|
|
|
|
LL | | }
|
2017-04-23 13:25:22 +00:00
|
|
|
| |_____^
|
2017-02-17 03:53:14 +00:00
|
|
|
|
2017-06-01 04:22:15 +00:00
|
|
|
error: this loop never actually loops
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:54:5
|
2017-06-01 04:22:15 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / loop {
|
|
|
|
LL | | // never loops
|
|
|
|
LL | | while i == 0 {
|
|
|
|
LL | | // never loops
|
2018-12-10 05:27:19 +00:00
|
|
|
... |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | return;
|
|
|
|
LL | | }
|
2017-12-07 10:20:48 +00:00
|
|
|
| |_____^
|
2017-06-01 04:22:15 +00:00
|
|
|
|
|
|
|
error: this loop never actually loops
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:56:9
|
2017-06-01 04:22:15 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / while i == 0 {
|
|
|
|
LL | | // never loops
|
|
|
|
LL | | break;
|
|
|
|
LL | | }
|
2017-06-01 04:22:15 +00:00
|
|
|
| |_________^
|
|
|
|
|
|
|
|
error: this loop never actually loops
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:68:9
|
2017-06-01 04:22:15 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / loop {
|
|
|
|
LL | | // never loops
|
|
|
|
LL | | if x == 5 {
|
|
|
|
LL | | break;
|
|
|
|
LL | | }
|
|
|
|
LL | | continue 'outer;
|
|
|
|
LL | | }
|
2017-12-07 10:20:48 +00:00
|
|
|
| |_________^
|
2017-06-01 04:22:15 +00:00
|
|
|
|
|
|
|
error: this loop never actually loops
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:104:5
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | / while let Some(y) = x {
|
|
|
|
LL | | // never loops
|
|
|
|
LL | | return;
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2017-06-01 04:22:15 +00:00
|
|
|
|
|
|
|
error: this loop never actually loops
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:111:5
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | / for x in 0..10 {
|
|
|
|
LL | | // never loops
|
|
|
|
LL | | match x {
|
|
|
|
LL | | 1 => break,
|
|
|
|
LL | | _ => return,
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2021-08-12 09:16:25 +00:00
|
|
|
|
|
|
|
|
help: if you need the first element of the iterator, try writing
|
|
|
|
|
|
|
|
|
LL | if let Some(x) = (0..10).next() {
|
|
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2017-06-01 04:22:15 +00:00
|
|
|
|
2017-10-08 22:26:39 +00:00
|
|
|
error: this loop never actually loops
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:159:5
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | / 'outer: while a {
|
|
|
|
LL | | // never loops
|
|
|
|
LL | | while a {
|
|
|
|
LL | | if a {
|
|
|
|
... |
|
|
|
|
LL | | break 'outer;
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2017-10-08 22:26:39 +00:00
|
|
|
|
2017-11-05 14:43:28 +00:00
|
|
|
error: this loop never actually loops
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:174:9
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | / while false {
|
|
|
|
LL | | break 'label;
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
2017-11-05 14:43:28 +00:00
|
|
|
|
2022-09-19 10:02:17 +00:00
|
|
|
error: this loop never actually loops
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:225:13
|
2022-09-19 10:02:17 +00:00
|
|
|
|
|
|
|
|
LL | let _ = loop {
|
|
|
|
| _____________^
|
|
|
|
LL | | let Some(x) = x else {
|
|
|
|
LL | | return;
|
|
|
|
LL | | };
|
|
|
|
LL | |
|
|
|
|
LL | | break x;
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
2022-11-16 06:09:09 +00:00
|
|
|
error: this loop never actually loops
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:246:5
|
2022-11-16 06:09:09 +00:00
|
|
|
|
|
|
|
|
LL | / 'a: loop {
|
|
|
|
LL | | 'b: {
|
|
|
|
LL | | break 'b 'c: {
|
|
|
|
LL | | break 'a;
|
|
|
|
LL | | };
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
2023-05-15 19:46:24 +00:00
|
|
|
error: sub-expression diverges
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:249:17
|
2023-05-15 19:46:24 +00:00
|
|
|
|
|
|
|
|
LL | break 'a;
|
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: `-D clippy::diverging-sub-expression` implied by `-D warnings`
|
|
|
|
|
2023-02-13 19:37:36 +00:00
|
|
|
error: this loop never actually loops
|
2023-06-22 09:31:05 +00:00
|
|
|
--> $DIR/never_loop.rs:280:13
|
2023-02-13 19:37:36 +00:00
|
|
|
|
|
|
|
|
LL | / for _ in 0..20 {
|
|
|
|
LL | | break 'block;
|
|
|
|
LL | | }
|
|
|
|
| |_____________^
|
|
|
|
|
|
|
|
|
help: if you need the first element of the iterator, try writing
|
|
|
|
|
|
|
|
|
LL | if let Some(_) = (0..20).next() {
|
|
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2023-06-22 09:31:05 +00:00
|
|
|
error: this loop never actually loops
|
|
|
|
--> $DIR/never_loop.rs:324:5
|
|
|
|
|
|
|
|
|
LL | / loop {
|
|
|
|
LL | | 'label: {
|
|
|
|
LL | | let x = true;
|
|
|
|
LL | | // Lints because we cannot prove it's always `true`
|
|
|
|
... |
|
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
error: aborting due to 14 previous errors
|
2018-01-16 16:06:27 +00:00
|
|
|
|