2017-02-07 21:05:30 +01:00
|
|
|
error: this loop could be written as a `while let` loop
|
2017-08-01 17:54:21 +02:00
|
|
|
--> $DIR/while_loop.rs:9:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-04-23 15:25:22 +02:00
|
|
|
9 | / loop {
|
2017-05-11 17:13:32 +02:00
|
|
|
10 | | if let Some(_x) = y {
|
|
|
|
11 | | let _v = 1;
|
|
|
|
12 | | } else {
|
|
|
|
13 | | break
|
|
|
|
14 | | }
|
|
|
|
15 | | }
|
2017-07-21 10:40:23 +02:00
|
|
|
| |_____^ help: try: `while let Some(_x) = y { .. }`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-05-17 14:19:44 +02:00
|
|
|
= note: `-D while-let-loop` implied by `-D warnings`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
error: this loop could be written as a `while let` loop
|
2017-08-01 17:54:21 +02:00
|
|
|
--> $DIR/while_loop.rs:22:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-05-11 17:13:32 +02:00
|
|
|
22 | / loop {
|
|
|
|
23 | | match y {
|
|
|
|
24 | | Some(_x) => true,
|
|
|
|
25 | | None => break
|
|
|
|
26 | | };
|
|
|
|
27 | | }
|
2017-07-21 10:40:23 +02:00
|
|
|
| |_____^ help: try: `while let Some(_x) = y { .. }`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
error: this loop could be written as a `while let` loop
|
2017-08-01 17:54:21 +02:00
|
|
|
--> $DIR/while_loop.rs:28:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-05-11 17:13:32 +02:00
|
|
|
28 | / loop {
|
|
|
|
29 | | let x = match y {
|
|
|
|
30 | | Some(x) => x,
|
|
|
|
31 | | None => break
|
2017-04-10 15:36:07 +02:00
|
|
|
... |
|
2017-05-11 17:13:32 +02:00
|
|
|
34 | | let _str = "foo";
|
|
|
|
35 | | }
|
2017-07-21 10:40:23 +02:00
|
|
|
| |_____^ help: try: `while let Some(x) = y { .. }`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
error: this loop could be written as a `while let` loop
|
2017-08-01 17:54:21 +02:00
|
|
|
--> $DIR/while_loop.rs:36:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-05-11 17:13:32 +02:00
|
|
|
36 | / loop {
|
|
|
|
37 | | let x = match y {
|
|
|
|
38 | | Some(x) => x,
|
|
|
|
39 | | None => break,
|
2017-04-10 15:36:07 +02:00
|
|
|
... |
|
2017-05-11 17:13:32 +02:00
|
|
|
42 | | { let _b = "foobar"; }
|
|
|
|
43 | | }
|
2017-07-21 10:40:23 +02:00
|
|
|
| |_____^ help: try: `while let Some(x) = y { .. }`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
error: this loop could be written as a `while let` loop
|
2017-08-01 17:54:21 +02:00
|
|
|
--> $DIR/while_loop.rs:58:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-05-11 17:13:32 +02: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 15:36:07 +02:00
|
|
|
... |
|
2017-05-11 17:13:32 +02:00
|
|
|
64 | | let _ = (e, l);
|
|
|
|
65 | | }
|
2017-07-21 10:40:23 +02:00
|
|
|
| |_____^ help: try: `while let Some(word) = "".split_whitespace().next() { .. }`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
error: this loop could be written as a `for` loop
|
2017-08-01 17:54:21 +02:00
|
|
|
--> $DIR/while_loop.rs:68:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-05-11 17:13:32 +02:00
|
|
|
68 | / while let Option::Some(x) = iter.next() {
|
|
|
|
69 | | println!("{}", x);
|
|
|
|
70 | | }
|
2017-07-21 10:40:23 +02:00
|
|
|
| |_____^ help: try: `for x in iter { .. }`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-05-17 14:19:44 +02:00
|
|
|
= note: `-D while-let-on-iterator` implied by `-D warnings`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
error: this loop could be written as a `for` loop
|
2017-08-01 17:54:21 +02:00
|
|
|
--> $DIR/while_loop.rs:73:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-05-11 17:13:32 +02:00
|
|
|
73 | / while let Some(x) = iter.next() {
|
|
|
|
74 | | println!("{}", x);
|
|
|
|
75 | | }
|
2017-07-21 10:40:23 +02:00
|
|
|
| |_____^ help: try: `for x in iter { .. }`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
error: this loop could be written as a `for` loop
|
2017-08-01 17:54:21 +02:00
|
|
|
--> $DIR/while_loop.rs:78:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-05-11 17:13:32 +02:00
|
|
|
78 | while let Some(_) = iter.next() {}
|
2017-07-21 10:40:23 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in iter { .. }`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
error: this loop could be written as a `while let` loop
|
2017-08-01 17:54:21 +02:00
|
|
|
--> $DIR/while_loop.rs:118:5
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-05-11 17:13:32 +02:00
|
|
|
118 | / loop {
|
|
|
|
119 | | let _ = match iter.next() {
|
|
|
|
120 | | Some(ele) => ele,
|
|
|
|
121 | | None => break
|
|
|
|
122 | | };
|
|
|
|
123 | | loop {}
|
|
|
|
124 | | }
|
2017-07-21 10:40:23 +02:00
|
|
|
| |_____^ help: try: `while let Some(ele) = iter.next() { .. }`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
|
|
error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body.
|
2017-08-01 17:54:21 +02:00
|
|
|
--> $DIR/while_loop.rs:123:9
|
2017-02-07 21:05:30 +01:00
|
|
|
|
|
2017-05-11 17:13:32 +02:00
|
|
|
123 | loop {}
|
2017-02-07 21:05:30 +01:00
|
|
|
| ^^^^^^^
|
|
|
|
|
|
2017-05-17 14:19:44 +02:00
|
|
|
= note: `-D empty-loop` implied by `-D warnings`
|
2017-02-07 21:05:30 +01:00
|
|
|
|
2017-08-01 00:58:26 +02:00
|
|
|
error: this loop could be written as a `for` loop
|
|
|
|
--> while_loop.rs:177:9
|
|
|
|
|
|
|
|
|
177 | / while let Some(v) = y.next() {
|
|
|
|
178 | | }
|
|
|
|
| |_________^ help: try: `for v in y { .. }`
|
|
|
|
|
|
|
|
error: aborting due to 11 previous errors
|
2017-02-07 21:05:30 +01:00
|
|
|
|