rust/tests/ui/while_loop.stderr

110 lines
3.2 KiB
Plaintext
Raw Normal View History

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
|
9 | / loop {
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 { .. }`
|
= note: `-D while-let-loop` implied by `-D warnings`
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
|
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 { .. }`
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
|
28 | / loop {
29 | | let x = match y {
30 | | Some(x) => x,
31 | | None => break
... |
34 | | let _str = "foo";
35 | | }
2017-07-21 03:40:23 -05:00
| |_____^ help: try: `while let Some(x) = y { .. }`
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
|
36 | / loop {
37 | | let x = match y {
38 | | Some(x) => x,
39 | | None => break,
... |
42 | | { let _b = "foobar"; }
43 | | }
2017-07-21 03:40:23 -05:00
| |_____^ help: try: `while let Some(x) = y { .. }`
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
|
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 03:40:23 -05:00
| |_____^ help: try: `while let Some(word) = "".split_whitespace().next() { .. }`
error: this loop could be written as a `for` loop
2018-01-28 22:18:11 -06:00
--> $DIR/while_loop.rs:68:33
|
2018-01-28 22:18:11 -06:00
68 | while let Option::Some(x) = iter.next() {
| ^^^^^^^^^^^ 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
2018-01-28 22:18:11 -06:00
--> $DIR/while_loop.rs:73:25
|
2018-01-28 22:18:11 -06:00
73 | while let Some(x) = iter.next() {
| ^^^^^^^^^^^ help: try: `for x in iter { .. }`
error: this loop could be written as a `for` loop
2018-01-28 22:18:11 -06:00
--> $DIR/while_loop.rs:78:25
|
78 | while let Some(_) = iter.next() {}
2018-01-28 22:18:11 -06:00
| ^^^^^^^^^^^ help: try: `for _ in iter { .. }`
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
|
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() { .. }`
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
|
123 | loop {}
| ^^^^^^^
|
= note: `-D empty-loop` implied by `-D warnings`
error: this loop could be written as a `for` loop
2018-01-28 22:18:11 -06:00
--> $DIR/while_loop.rs:183:29
|
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 { .. }`
2018-01-16 10:06:27 -06:00
error: aborting due to 11 previous errors