]> git.lizzy.rs Git - rust.git/blob - tests/ui/while_loop.stderr
Merge pull request #1923 from killercup/feature/1917-docs-versions-index
[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:5
64    |
65 68 | /     while let Option::Some(x) = iter.next() {
66 69 | |         println!("{}", x);
67 70 | |     }
68    | |_____^ help: try: `for x in iter { .. }`
69    |
70    = note: `-D while-let-on-iterator` implied by `-D warnings`
71
72 error: this loop could be written as a `for` loop
73   --> $DIR/while_loop.rs:73:5
74    |
75 73 | /     while let Some(x) = iter.next() {
76 74 | |         println!("{}", x);
77 75 | |     }
78    | |_____^ help: try: `for x in iter { .. }`
79
80 error: this loop could be written as a `for` loop
81   --> $DIR/while_loop.rs:78:5
82    |
83 78 |     while let Some(_) = iter.next() {}
84    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in iter { .. }`
85
86 error: this loop could be written as a `while let` loop
87    --> $DIR/while_loop.rs:118:5
88     |
89 118 | /     loop {
90 119 | |         let _ = match iter.next() {
91 120 | |             Some(ele) => ele,
92 121 | |             None => break
93 122 | |         };
94 123 | |         loop {}
95 124 | |     }
96     | |_____^ help: try: `while let Some(ele) = iter.next() { .. }`
97
98 error: empty `loop {}` detected. You may want to either use `panic!()` or add `std::thread::sleep(..);` to the loop body.
99    --> $DIR/while_loop.rs:123:9
100     |
101 123 |         loop {}
102     |         ^^^^^^^
103     |
104     = note: `-D empty-loop` implied by `-D warnings`
105
106 error: this loop could be written as a `for` loop
107    --> $DIR/while_loop.rs:183:9
108     |
109 183 | /         while let Some(v) = y.next() { // use a for loop here
110 184 | |         }
111     | |_________^ help: try: `for v in y { .. }`
112
113 error: aborting due to 11 previous errors
114