rust-clippy/tests/ui/while_loop.stderr

116 lines
3.5 KiB
Text
Raw Normal View History

error: this loop could be written as a `while let` loop
2017-08-01 15:54:21 +00: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 08:40:23 +00: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 15:54:21 +00:00
--> $DIR/while_loop.rs:22:5
|
22 | / loop {
23 | | match y {
24 | | Some(_x) => true,
25 | | None => break
26 | | };
27 | | }
2017-07-21 08:40:23 +00:00
| |_____^ help: try: `while let Some(_x) = y { .. }`
error: this loop could be written as a `while let` loop
2017-08-01 15:54:21 +00: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 08:40:23 +00:00
| |_____^ help: try: `while let Some(x) = y { .. }`
error: this loop could be written as a `while let` loop
2017-08-01 15:54:21 +00: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 08:40:23 +00:00
| |_____^ help: try: `while let Some(x) = y { .. }`
error: this loop could be written as a `while let` loop
2017-08-01 15:54:21 +00: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 08:40:23 +00:00
| |_____^ help: try: `while let Some(word) = "".split_whitespace().next() { .. }`
error: this loop could be written as a `for` loop
2018-01-29 04:18:11 +00:00
--> $DIR/while_loop.rs:68:33
|
2018-01-29 04:18:11 +00: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-29 04:18:11 +00:00
--> $DIR/while_loop.rs:73:25
|
2018-01-29 04:18:11 +00: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-29 04:18:11 +00:00
--> $DIR/while_loop.rs:78:25
|
78 | while let Some(_) = iter.next() {}
2018-01-29 04:18:11 +00:00
| ^^^^^^^^^^^ help: try: `for _ in iter { .. }`
error: this loop could be written as a `while let` loop
2017-08-01 15:54:21 +00: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 08:40:23 +00: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 15:54:21 +00: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-29 04:18:11 +00:00
--> $DIR/while_loop.rs:183:29
|
2018-01-29 04:18:11 +00:00
183 | while let Some(v) = y.next() { // use a for loop here
| ^^^^^^^^ help: try: `for v in y { .. }`
error: this loop could be written as a `for` loop
--> $DIR/while_loop.rs:210:26
|
210 | while let Some(..) = values.iter().next() {
| ^^^^^^^^^^^^^^^^^^^^ help: try: `for _ in values.iter() { .. }`
error: aborting due to 12 previous errors
2018-01-16 16:06:27 +00:00