]> git.lizzy.rs Git - rust.git/blob - tests/ui/while_loop.stderr
Merge branch 'master' into rustfmt_tests
[rust.git] / tests / ui / while_loop.stderr
1 error: this loop could be written as a `while let` loop
2   --> $DIR/while_loop.rs:15:5
3    |
4 15 | /     loop {
5 16 | |         if let Some(_x) = y {
6 17 | |             let _v = 1;
7 18 | |         } else {
8 19 | |             break;
9 20 | |         }
10 21 | |     }
11    | |_____^ help: try: `while let Some(_x) = y { .. }`
12    |
13    = note: `-D clippy::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:29:5
17    |
18 29 | /     loop {
19 30 | |         match y {
20 31 | |             Some(_x) => true,
21 32 | |             None => break,
22 33 | |         };
23 34 | |     }
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:35:5
28    |
29 35 | /     loop {
30 36 | |         let x = match y {
31 37 | |             Some(x) => x,
32 38 | |             None => break,
33 ...  |
34 41 | |         let _str = "foo";
35 42 | |     }
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:43:5
40    |
41 43 | /     loop {
42 44 | |         let x = match y {
43 45 | |             Some(x) => x,
44 46 | |             None => break,
45 ...  |
46 53 | |         }
47 54 | |     }
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:71:5
52    |
53 71 | /     loop {
54 72 | |         let (e, l) = match "".split_whitespace().next() {
55 73 | |             Some(word) => (word.is_empty(), word.len()),
56 74 | |             None => break,
57 ...  |
58 77 | |         let _ = (e, l);
59 78 | |     }
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:81:33
64    |
65 81 |     while let Option::Some(x) = iter.next() {
66    |                                 ^^^^^^^^^^^ help: try: `for x in iter { .. }`
67    |
68    = note: `-D clippy::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:86:25
72    |
73 86 |     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:91:25
78    |
79 91 |     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:134:5
84     |
85 134 | /     loop {
86 135 | |         let _ = match iter.next() {
87 136 | |             Some(ele) => ele,
88 137 | |             None => break,
89 138 | |         };
90 139 | |         loop {}
91 140 | |     }
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:139:9
96     |
97 139 |         loop {}
98     |         ^^^^^^^
99     |
100     = note: `-D clippy::empty-loop` implied by `-D warnings`
101
102 error: this loop could be written as a `for` loop
103    --> $DIR/while_loop.rs:197:29
104     |
105 197 |         while let Some(v) = y.next() {
106     |                             ^^^^^^^^ help: try: `for v in y { .. }`
107
108 error: this loop could be written as a `for` loop
109    --> $DIR/while_loop.rs:225:26
110     |
111 225 |     while let Some(..) = values.iter().next() {
112     |                          ^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in values.iter() { .. }`
113
114 error: aborting due to 12 previous errors
115