2017-02-07 14:05:30 -06:00
|
|
|
error: this loop could be written as a `while let` loop
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/while_loop.rs:9:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-04-23 08:25:22 -05:00
|
|
|
9 | / loop {
|
2017-05-11 10:13:32 -05:00
|
|
|
10 | | if let Some(_x) = y {
|
|
|
|
11 | | let _v = 1;
|
|
|
|
12 | | } else {
|
|
|
|
13 | | break
|
|
|
|
14 | | }
|
|
|
|
15 | | }
|
2017-07-21 03:40:23 -05:00
|
|
|
| |_____^ help: try: `while let Some(_x) = y { .. }`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-17 07:19:44 -05:00
|
|
|
= note: `-D 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
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/while_loop.rs:22:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 10:13:32 -05:00
|
|
|
22 | / loop {
|
|
|
|
23 | | match y {
|
|
|
|
24 | | Some(_x) => true,
|
|
|
|
25 | | None => break
|
|
|
|
26 | | };
|
|
|
|
27 | | }
|
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
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/while_loop.rs:28:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 10:13:32 -05:00
|
|
|
28 | / loop {
|
|
|
|
29 | | let x = match y {
|
|
|
|
30 | | Some(x) => x,
|
|
|
|
31 | | None => break
|
2017-04-10 08:36:07 -05:00
|
|
|
... |
|
2017-05-11 10:13:32 -05:00
|
|
|
34 | | let _str = "foo";
|
|
|
|
35 | | }
|
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
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/while_loop.rs:36:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 10:13:32 -05:00
|
|
|
36 | / loop {
|
|
|
|
37 | | let x = match y {
|
|
|
|
38 | | Some(x) => x,
|
|
|
|
39 | | None => break,
|
2017-04-10 08:36:07 -05:00
|
|
|
... |
|
2017-05-11 10:13:32 -05:00
|
|
|
42 | | { let _b = "foobar"; }
|
|
|
|
43 | | }
|
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
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/while_loop.rs:58:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 10:13:32 -05:00
|
|
|
58 | / loop {
|
|
|
|
59 | | let (e, l) = match "".split_whitespace().next() {
|
|
|
|
60 | | Some(word) => (word.is_empty(), word.len()),
|
|
|
|
61 | | None => break
|
2017-04-10 08:36:07 -05:00
|
|
|
... |
|
2017-05-11 10:13:32 -05:00
|
|
|
64 | | let _ = (e, l);
|
|
|
|
65 | | }
|
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-01-28 22:18:11 -06:00
|
|
|
--> $DIR/while_loop.rs:68:33
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-01-28 22:18:11 -06:00
|
|
|
68 | while let Option::Some(x) = iter.next() {
|
|
|
|
| ^^^^^^^^^^^ help: try: `for x in iter { .. }`
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-17 07:19:44 -05:00
|
|
|
= note: `-D 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-01-28 22:18:11 -06:00
|
|
|
--> $DIR/while_loop.rs:73:25
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2018-01-28 22:18:11 -06:00
|
|
|
73 | while let Some(x) = iter.next() {
|
|
|
|
| ^^^^^^^^^^^ 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-01-28 22:18:11 -06:00
|
|
|
--> $DIR/while_loop.rs:78:25
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 10:13:32 -05:00
|
|
|
78 | 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
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/while_loop.rs:118:5
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 10:13:32 -05:00
|
|
|
118 | / loop {
|
|
|
|
119 | | let _ = match iter.next() {
|
|
|
|
120 | | Some(ele) => ele,
|
|
|
|
121 | | None => break
|
|
|
|
122 | | };
|
|
|
|
123 | | loop {}
|
|
|
|
124 | | }
|
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.
|
2017-08-01 10:54:21 -05:00
|
|
|
--> $DIR/while_loop.rs:123:9
|
2017-02-07 14:05:30 -06:00
|
|
|
|
|
2017-05-11 10:13:32 -05:00
|
|
|
123 | loop {}
|
2017-02-07 14:05:30 -06:00
|
|
|
| ^^^^^^^
|
|
|
|
|
|
2017-05-17 07:19:44 -05:00
|
|
|
= note: `-D 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-01-28 22:18:11 -06:00
|
|
|
--> $DIR/while_loop.rs:183:29
|
2017-07-31 17:58:26 -05:00
|
|
|
|
|
2018-01-28 22:18:11 -06:00
|
|
|
183 | while let Some(v) = y.next() { // use a for loop here
|
|
|
|
| ^^^^^^^^ 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
|
|
|
|
--> $DIR/while_loop.rs:210:26
|
|
|
|
|
|
|
|
|
210 | while let Some(..) = values.iter().next() {
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in values.iter() { .. }`
|
|
|
|
|
|
|
|
error: aborting due to 12 previous errors
|
2018-01-16 10:06:27 -06:00
|
|
|
|