]> git.lizzy.rs Git - rust.git/blob - tests/ui/while_loop.stderr
Merge pull request #3918 from matthiaskrgr/typos
[rust.git] / tests / ui / while_loop.stderr
1 error: this loop could be written as a `while let` loop
2   --> $DIR/while_loop.rs:6:5
3    |
4 LL | /     loop {
5 LL | |         if let Some(_x) = y {
6 LL | |             let _v = 1;
7 LL | |         } else {
8 LL | |             break;
9 LL | |         }
10 LL | |     }
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:20:5
17    |
18 LL | /     loop {
19 LL | |         match y {
20 LL | |             Some(_x) => true,
21 LL | |             None => break,
22 LL | |         };
23 LL | |     }
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:26:5
28    |
29 LL | /     loop {
30 LL | |         let x = match y {
31 LL | |             Some(x) => x,
32 LL | |             None => break,
33 ...  |
34 LL | |         let _str = "foo";
35 LL | |     }
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:34:5
40    |
41 LL | /     loop {
42 LL | |         let x = match y {
43 LL | |             Some(x) => x,
44 LL | |             None => break,
45 ...  |
46 LL | |         }
47 LL | |     }
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:62:5
52    |
53 LL | /     loop {
54 LL | |         let (e, l) = match "".split_whitespace().next() {
55 LL | |             Some(word) => (word.is_empty(), word.len()),
56 LL | |             None => break,
57 ...  |
58 LL | |         let _ = (e, l);
59 LL | |     }
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:72:33
64    |
65 LL |     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:77:25
72    |
73 LL |     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:82:25
78    |
79 LL |     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:125:5
84    |
85 LL | /     loop {
86 LL | |         let _ = match iter.next() {
87 LL | |             Some(ele) => ele,
88 LL | |             None => break,
89 LL | |         };
90 LL | |         loop {}
91 LL | |     }
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:130:9
96    |
97 LL |         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:188:29
104    |
105 LL |         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:216:26
110    |
111 LL |     while let Some(..) = values.iter().next() {
112    |                          ^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in values.iter() { .. }`
113
114 error: aborting due to 12 previous errors
115