2017-02-17 03:53:14 +00:00
|
|
|
error: this loop never actually loops
|
2023-07-02 12:35:19 +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 {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
|
|
|
LL | |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | // clippy::never_loop
|
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-08-24 19:32:12 +00:00
|
|
|
--> $DIR/never_loop.rs:36:5
|
2017-02-17 03:53:14 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / loop {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2018-12-27 15:57:55 +00:00
|
|
|
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-08-24 19:32:12 +00:00
|
|
|
--> $DIR/never_loop.rs:57:5
|
2017-06-01 04:22:15 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / loop {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | // never loops
|
|
|
|
LL | | while i == 0 {
|
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-08-24 19:32:12 +00:00
|
|
|
--> $DIR/never_loop.rs:60:9
|
2017-06-01 04:22:15 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / while i == 0 {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | // never loops
|
|
|
|
LL | | break;
|
|
|
|
LL | | }
|
2017-06-01 04:22:15 +00:00
|
|
|
| |_________^
|
|
|
|
|
|
|
|
error: this loop never actually loops
|
2023-08-24 19:32:12 +00:00
|
|
|
--> $DIR/never_loop.rs:73:9
|
2017-06-01 04:22:15 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | / loop {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | // never loops
|
|
|
|
LL | | if x == 5 {
|
2023-08-24 19:32:12 +00:00
|
|
|
... |
|
2018-12-27 15:57:55 +00:00
|
|
|
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-08-24 19:32:12 +00:00
|
|
|
--> $DIR/never_loop.rs:110:5
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | / while let Some(y) = x {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | // never loops
|
|
|
|
LL | | return;
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
2017-06-01 04:22:15 +00:00
|
|
|
|
|
|
|
error: this loop never actually loops
|
2023-08-24 19:32:12 +00:00
|
|
|
--> $DIR/never_loop.rs:118:5
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | / for x in 0..10 {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | // never loops
|
|
|
|
LL | | match x {
|
2023-08-24 19:32:12 +00:00
|
|
|
... |
|
2018-12-27 15:57:55 +00:00
|
|
|
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-08-24 19:32:12 +00:00
|
|
|
--> $DIR/never_loop.rs:167:5
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | / 'outer: while a {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | // never loops
|
|
|
|
LL | | while 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-08-24 19:32:12 +00:00
|
|
|
--> $DIR/never_loop.rs:183:9
|
2018-12-27 15:57:55 +00:00
|
|
|
|
|
|
|
|
LL | / while false {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | | break 'label;
|
|
|
|
LL | | }
|
|
|
|
| |_________^
|
2017-11-05 14:43:28 +00:00
|
|
|
|
2022-10-06 07:44:38 +00:00
|
|
|
error: this loop never actually loops
|
2023-08-24 19:32:12 +00:00
|
|
|
--> $DIR/never_loop.rs:235:13
|
2022-10-06 07:44:38 +00:00
|
|
|
|
|
|
|
|
LL | let _ = loop {
|
|
|
|
| _____________^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2022-10-06 07:44:38 +00:00
|
|
|
LL | | let Some(x) = x else {
|
|
|
|
LL | | return;
|
2023-08-24 19:32:12 +00:00
|
|
|
... |
|
2022-10-06 07:44:38 +00:00
|
|
|
LL | | break x;
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
2022-11-21 19:34:47 +00:00
|
|
|
error: this loop never actually loops
|
2023-08-24 19:32:12 +00:00
|
|
|
--> $DIR/never_loop.rs:257:5
|
2022-11-21 19:34:47 +00:00
|
|
|
|
|
|
|
|
LL | / 'a: loop {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2022-11-21 19:34:47 +00:00
|
|
|
LL | | 'b: {
|
|
|
|
LL | | break 'b 'c: {
|
2023-08-24 19:32:12 +00:00
|
|
|
... |
|
2022-11-21 19:34:47 +00:00
|
|
|
LL | | }
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
error: sub-expression diverges
|
2023-08-24 19:32:12 +00:00
|
|
|
--> $DIR/never_loop.rs:261:17
|
2023-07-02 12:35:19 +00:00
|
|
|
|
|
|
|
|
LL | break 'a;
|
|
|
|
| ^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: `-D clippy::diverging-sub-expression` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::diverging_sub_expression)]`
|
2023-07-02 12:35:19 +00:00
|
|
|
|
2023-02-26 00:08:29 +00:00
|
|
|
error: this loop never actually loops
|
2023-08-24 19:32:12 +00:00
|
|
|
--> $DIR/never_loop.rs:294:13
|
2023-02-26 00:08:29 +00:00
|
|
|
|
|
|
|
|
LL | / for _ in 0..20 {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2023-02-26 00:08:29 +00:00
|
|
|
LL | | break 'block;
|
|
|
|
LL | | }
|
|
|
|
| |_____________^
|
|
|
|
|
|
|
|
|
help: if you need the first element of the iterator, try writing
|
|
|
|
|
|
|
|
|
LL | if let Some(_) = (0..20).next() {
|
|
|
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
error: this loop never actually loops
|
2023-09-02 05:43:12 +00:00
|
|
|
--> $DIR/never_loop.rs:378:13
|
2023-06-22 09:31:05 +00:00
|
|
|
|
|
2023-09-02 05:43:12 +00:00
|
|
|
LL | / 'c: loop {
|
2023-07-28 19:35:48 +00:00
|
|
|
LL | |
|
2023-09-02 05:43:12 +00:00
|
|
|
LL | | if b { break 'c } else { break 'b }
|
|
|
|
LL | | }
|
|
|
|
| |_____________^
|
2023-06-22 09:31:05 +00:00
|
|
|
|
2023-09-02 11:51:34 +00:00
|
|
|
error: this loop never actually loops
|
|
|
|
--> $DIR/never_loop.rs:389:5
|
2023-07-02 12:35:19 +00:00
|
|
|
|
|
|
|
|
LL | / loop {
|
2023-08-24 19:32:12 +00:00
|
|
|
LL | |
|
2023-09-02 11:51:34 +00:00
|
|
|
LL | | panic!("oh no");
|
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
2023-09-03 15:16:06 +00:00
|
|
|
error: this loop never actually loops
|
|
|
|
--> $DIR/never_loop.rs:393:5
|
|
|
|
|
|
|
|
|
LL | / loop {
|
|
|
|
LL | |
|
|
|
|
LL | | unimplemented!("not yet");
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | | }
|
|
|
|
| |_____^
|
|
|
|
|
2023-09-03 15:16:06 +00:00
|
|
|
error: aborting due to 16 previous errors
|
2018-01-16 16:06:27 +00:00
|
|
|
|