rust/tests/ui/while_loop.stderr

115 lines
3.2 KiB
Plaintext
Raw Normal View History

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
|
9 | / loop {
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 { .. }`
|
= note: `-D while-let-loop` implied by `-D warnings`
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
|
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 { .. }`
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
|
28 | / loop {
29 | | let x = match y {
30 | | Some(x) => x,
31 | | None => break
... |
34 | | let _str = "foo";
35 | | }
2017-07-21 10:40:23 +02:00
| |_____^ help: try: `while let Some(x) = y { .. }`
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
|
36 | / loop {
37 | | let x = match y {
38 | | Some(x) => x,
39 | | None => break,
... |
42 | | { let _b = "foobar"; }
43 | | }
2017-07-21 10:40:23 +02:00
| |_____^ help: try: `while let Some(x) = y { .. }`
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
|
58 | / loop {
59 | | let (e, l) = match "".split_whitespace().next() {
60 | | Some(word) => (word.is_empty(), word.len()),
61 | | None => break
... |
64 | | let _ = (e, l);
65 | | }
2017-07-21 10:40:23 +02:00
| |_____^ help: try: `while let Some(word) = "".split_whitespace().next() { .. }`
error: this loop could be written as a `for` loop
2017-08-01 17:54:21 +02:00
--> $DIR/while_loop.rs:68:5
|
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 { .. }`
|
= note: `-D while-let-on-iterator` implied by `-D warnings`
error: this loop could be written as a `for` loop
2017-08-01 17:54:21 +02:00
--> $DIR/while_loop.rs:73:5
|
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 { .. }`
error: this loop could be written as a `for` loop
2017-08-01 17:54:21 +02:00
--> $DIR/while_loop.rs:78:5
|
78 | while let Some(_) = iter.next() {}
2017-07-21 10:40:23 +02:00
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in iter { .. }`
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
|
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() { .. }`
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
|
123 | loop {}
| ^^^^^^^
|
= note: `-D empty-loop` implied by `-D warnings`
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