]> git.lizzy.rs Git - rust.git/blob - tests/ui/while_loop.stderr
Merge pull request #2984 from flip1995/single_char_pattern
[rust.git] / tests / ui / while_loop.stderr
1 error: this loop could be written as a `while let` loop
2   --> $DIR/while_loop.rs:9:5
3    |
4 9  | /     loop {
5 10 | |         if let Some(_x) = y {
6 11 | |             let _v = 1;
7 12 | |         } else {
8 13 | |             break
9 14 | |         }
10 15 | |     }
11    | |_____^ help: try: `while let Some(_x) = y { .. }`
12    |
13    = note: `-D while-let-loop` implied by `-D warnings`
14
15 error: this loop could be written as a `while let` loop
16   --> $DIR/while_loop.rs:22:5
17    |
18 22 | /     loop {
19 23 | |         match y {
20 24 | |             Some(_x) => true,
21 25 | |             None => break
22 26 | |         };
23 27 | |     }
24    | |_____^ help: try: `while let Some(_x) = y { .. }`
25
26 error: this loop could be written as a `while let` loop
27   --> $DIR/while_loop.rs:28:5
28    |
29 28 | /     loop {
30 29 | |         let x = match y {
31 30 | |             Some(x) => x,
32 31 | |             None => break
33 ...  |
34 34 | |         let _str = "foo";
35 35 | |     }
36    | |_____^ help: try: `while let Some(x) = y { .. }`
37
38 error: this loop could be written as a `while let` loop
39   --> $DIR/while_loop.rs:36:5
40    |
41 36 | /     loop {
42 37 | |         let x = match y {
43 38 | |             Some(x) => x,
44 39 | |             None => break,
45 ...  |
46 42 | |         { let _b = "foobar"; }
47 43 | |     }
48    | |_____^ help: try: `while let Some(x) = y { .. }`
49
50 error: this loop could be written as a `while let` loop
51   --> $DIR/while_loop.rs:58:5
52    |
53 58 | /     loop {
54 59 | |         let (e, l) = match "".split_whitespace().next() {
55 60 | |             Some(word) => (word.is_empty(), word.len()),
56 61 | |             None => break
57 ...  |
58 64 | |         let _ = (e, l);
59 65 | |     }
60    | |_____^ help: try: `while let Some(word) = "".split_whitespace().next() { .. }`
61
62 error: this loop could be written as a `for` loop
63   --> $DIR/while_loop.rs:68:33
64    |
65 68 |     while let Option::Some(x) = iter.next() {
66    |                                 ^^^^^^^^^^^ help: try: `for x in iter { .. }`
67    |
68    = note: `-D while-let-on-iterator` implied by `-D warnings`
69
70 error: this loop could be written as a `for` loop
71   --> $DIR/while_loop.rs:73:25
72    |
73 73 |     while let Some(x) = iter.next() {
74    |                         ^^^^^^^^^^^ help: try: `for x in iter { .. }`
75
76 error: this loop could be written as a `for` loop
77   --> $DIR/while_loop.rs:78:25
78    |
79 78 |     while let Some(_) = iter.next() {}
80    |                         ^^^^^^^^^^^ help: try: `for _ in iter { .. }`
81
82 error: this loop could be written as a `while let` loop
83    --> $DIR/while_loop.rs:118:5
84     |
85 118 | /     loop {
86 119 | |         let _ = match iter.next() {
87 120 | |             Some(ele) => ele,
88 121 | |             None => break
89 122 | |         };
90 123 | |         loop {}
91 124 | |     }
92     | |_____^ help: try: `while let Some(ele) = iter.next() { .. }`
93
94 error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body.
95    --> $DIR/while_loop.rs:123:9
96     |
97 123 |         loop {}
98     |         ^^^^^^^
99     |
100     = note: `-D empty-loop` implied by `-D warnings`
101
102 error: this loop could be written as a `for` loop
103    --> $DIR/while_loop.rs:183:29
104     |
105 183 |         while let Some(v) = y.next() { // use a for loop here
106     |                             ^^^^^^^^ help: try: `for v in y { .. }`
107
108 error: aborting due to 11 previous errors
109