2017-02-07 14:05:30 -06:00
|
|
|
error: this loop could be written as a `while let` loop
|
2018-10-06 11:18:06 -05:00
|
|
|
--> $DIR/while_loop.rs:19:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-10-06 11:18:06 -05:00
|
|
|
19 | / loop {
|
|
|
|
20 | | if let Some(_x) = y {
|
|
|
|
21 | | let _v = 1;
|
|
|
|
22 | | } else {
|
|
|
|
23 | | break
|
|
|
|
24 | | }
|
|
|
|
25 | | }
|
2017-07-21 03:40:23 -05:00
|
|
|
| |_____^ help: try: `while let Some(_x) = y { .. }`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-08-01 09:30:44 -05:00
|
|
|
= note: `-D clippy::while-let-loop` implied by `-D warnings`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this loop could be written as a `while let` loop
|
2018-10-06 11:18:06 -05:00
|
|
|
--> $DIR/while_loop.rs:32:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-10-06 11:18:06 -05:00
|
|
|
32 | / loop {
|
|
|
|
33 | | match y {
|
|
|
|
34 | | Some(_x) => true,
|
|
|
|
35 | | None => break
|
|
|
|
36 | | };
|
|
|
|
37 | | }
|
2017-07-21 03:40:23 -05:00
|
|
|
| |_____^ help: try: `while let Some(_x) = y { .. }`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this loop could be written as a `while let` loop
|
2018-10-06 11:18:06 -05:00
|
|
|
--> $DIR/while_loop.rs:38:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-10-06 11:18:06 -05:00
|
|
|
38 | / loop {
|
|
|
|
39 | | let x = match y {
|
|
|
|
40 | | Some(x) => x,
|
|
|
|
41 | | None => break
|
2017-04-10 08:36:07 -05:00
|
|
|
... |
|
2018-10-06 11:18:06 -05:00
|
|
|
44 | | let _str = "foo";
|
|
|
|
45 | | }
|
2017-07-21 03:40:23 -05:00
|
|
|
| |_____^ help: try: `while let Some(x) = y { .. }`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this loop could be written as a `while let` loop
|
2018-10-06 11:18:06 -05:00
|
|
|
--> $DIR/while_loop.rs:46:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-10-06 11:18:06 -05:00
|
|
|
46 | / loop {
|
|
|
|
47 | | let x = match y {
|
|
|
|
48 | | Some(x) => x,
|
|
|
|
49 | | None => break,
|
2017-04-10 08:36:07 -05:00
|
|
|
... |
|
2018-10-06 11:18:06 -05:00
|
|
|
52 | | { let _b = "foobar"; }
|
|
|
|
53 | | }
|
2017-07-21 03:40:23 -05:00
|
|
|
| |_____^ help: try: `while let Some(x) = y { .. }`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this loop could be written as a `while let` loop
|
2018-10-06 11:18:06 -05:00
|
|
|
--> $DIR/while_loop.rs:68:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-10-06 11:18:06 -05:00
|
|
|
68 | / loop {
|
|
|
|
69 | | let (e, l) = match "".split_whitespace().next() {
|
|
|
|
70 | | Some(word) => (word.is_empty(), word.len()),
|
|
|
|
71 | | None => break
|
2017-04-10 08:36:07 -05:00
|
|
|
... |
|
2018-10-06 11:18:06 -05:00
|
|
|
74 | | let _ = (e, l);
|
|
|
|
75 | | }
|
2017-07-21 03:40:23 -05:00
|
|
|
| |_____^ help: try: `while let Some(word) = "".split_whitespace().next() { .. }`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this loop could be written as a `for` loop
|
2018-10-06 11:18:06 -05:00
|
|
|
--> $DIR/while_loop.rs:78:33
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-10-06 11:18:06 -05:00
|
|
|
78 | while let Option::Some(x) = iter.next() {
|
2018-01-28 22:18:11 -06:00
|
|
|
| ^^^^^^^^^^^ help: try: `for x in iter { .. }`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-08-01 09:30:44 -05:00
|
|
|
= note: `-D clippy::while-let-on-iterator` implied by `-D warnings`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this loop could be written as a `for` loop
|
2018-10-06 11:18:06 -05:00
|
|
|
--> $DIR/while_loop.rs:83:25
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-10-06 11:18:06 -05:00
|
|
|
83 | while let Some(x) = iter.next() {
|
2018-01-28 22:18:11 -06:00
|
|
|
| ^^^^^^^^^^^ help: try: `for x in iter { .. }`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this loop could be written as a `for` loop
|
2018-10-06 11:18:06 -05:00
|
|
|
--> $DIR/while_loop.rs:88:25
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-10-06 11:18:06 -05:00
|
|
|
88 | while let Some(_) = iter.next() {}
|
2018-01-28 22:18:11 -06:00
|
|
|
| ^^^^^^^^^^^ help: try: `for _ in iter { .. }`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: this loop could be written as a `while let` loop
|
2018-10-06 11:18:06 -05:00
|
|
|
--> $DIR/while_loop.rs:128:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-10-06 11:18:06 -05:00
|
|
|
128 | / loop {
|
|
|
|
129 | | let _ = match iter.next() {
|
|
|
|
130 | | Some(ele) => ele,
|
|
|
|
131 | | None => break
|
|
|
|
132 | | };
|
|
|
|
133 | | loop {}
|
|
|
|
134 | | }
|
2017-07-21 03:40:23 -05:00
|
|
|
| |_____^ help: try: `while let Some(ele) = iter.next() { .. }`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
|
|
error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body.
|
2018-10-06 11:18:06 -05:00
|
|
|
--> $DIR/while_loop.rs:133:9
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-10-06 11:18:06 -05:00
|
|
|
133 | loop {}
|
2017-02-07 14:05:30 -06:00
|
|
|
| ^^^^^^^
|
|
|
|
|
|
2018-08-01 09:30:44 -05:00
|
|
|
= note: `-D clippy::empty-loop` implied by `-D warnings`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
2017-07-31 17:58:26 -05:00
|
|
|
error: this loop could be written as a `for` loop
|
2018-10-06 11:18:06 -05:00
|
|
|
--> $DIR/while_loop.rs:193:29
|
2017-07-31 17:58:26 -05:00
|
|
|
|
|
2018-10-06 11:18:06 -05:00
|
|
|
193 | while let Some(v) = y.next() { // use a for loop here
|
2018-01-28 22:18:11 -06:00
|
|
|
| ^^^^^^^^ help: try: `for v in y { .. }`
|
2017-07-31 17:58:26 -05:00
|
|
|
|
2018-07-28 04:51:46 -05:00
|
|
|
error: this loop could be written as a `for` loop
|
2018-10-06 11:18:06 -05:00
|
|
|
--> $DIR/while_loop.rs:220:26
|
2018-07-28 04:51:46 -05:00
|
|
|
|
|
2018-10-06 11:18:06 -05:00
|
|
|
220 | while let Some(..) = values.iter().next() {
|
2018-07-28 04:51:46 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in values.iter() { .. }`
|
|
|
|
|
|
|
|
error: aborting due to 12 previous errors
|
2018-01-16 10:06:27 -06:00
|
|
|
|