rust/tests/ui/while_loop.stderr

116 lines
3.5 KiB
Plaintext
Raw Normal View History

error: this loop could be written as a `while let` loop
2018-10-06 16:18:06 +00:00
--> $DIR/while_loop.rs:19:5
|
2018-10-06 16:18:06 +00:00
19 | / loop {
20 | | if let Some(_x) = y {
21 | | let _v = 1;
22 | | } else {
23 | | break
24 | | }
25 | | }
2017-07-21 08:40:23 +00:00
| |_____^ help: try: `while let Some(_x) = y { .. }`
|
= note: `-D clippy::while-let-loop` implied by `-D warnings`
error: this loop could be written as a `while let` loop
2018-10-06 16:18:06 +00:00
--> $DIR/while_loop.rs:32:5
|
2018-10-06 16:18:06 +00:00
32 | / loop {
33 | | match y {
34 | | Some(_x) => true,
35 | | None => break
36 | | };
37 | | }
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
2018-10-06 16:18:06 +00:00
--> $DIR/while_loop.rs:38:5
|
2018-10-06 16:18:06 +00:00
38 | / loop {
39 | | let x = match y {
40 | | Some(x) => x,
41 | | None => break
... |
2018-10-06 16:18:06 +00:00
44 | | let _str = "foo";
45 | | }
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
2018-10-06 16:18:06 +00:00
--> $DIR/while_loop.rs:46:5
|
2018-10-06 16:18:06 +00:00
46 | / loop {
47 | | let x = match y {
48 | | Some(x) => x,
49 | | None => break,
... |
2018-10-06 16:18:06 +00:00
52 | | { let _b = "foobar"; }
53 | | }
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
2018-10-06 16:18:06 +00:00
--> $DIR/while_loop.rs:68:5
|
2018-10-06 16:18:06 +00:00
68 | / loop {
69 | | let (e, l) = match "".split_whitespace().next() {
70 | | Some(word) => (word.is_empty(), word.len()),
71 | | None => break
... |
2018-10-06 16:18:06 +00:00
74 | | let _ = (e, l);
75 | | }
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-10-06 16:18:06 +00:00
--> $DIR/while_loop.rs:78:33
|
2018-10-06 16:18:06 +00:00
78 | while let Option::Some(x) = iter.next() {
2018-01-29 04:18:11 +00:00
| ^^^^^^^^^^^ help: try: `for x in iter { .. }`
|
= note: `-D clippy::while-let-on-iterator` implied by `-D warnings`
error: this loop could be written as a `for` loop
2018-10-06 16:18:06 +00:00
--> $DIR/while_loop.rs:83:25
|
2018-10-06 16:18:06 +00:00
83 | while let Some(x) = iter.next() {
2018-01-29 04:18:11 +00:00
| ^^^^^^^^^^^ help: try: `for x in iter { .. }`
error: this loop could be written as a `for` loop
2018-10-06 16:18:06 +00:00
--> $DIR/while_loop.rs:88:25
|
2018-10-06 16:18:06 +00:00
88 | 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
2018-10-06 16:18:06 +00:00
--> $DIR/while_loop.rs:128:5
|
2018-10-06 16:18:06 +00:00
128 | / loop {
129 | | let _ = match iter.next() {
130 | | Some(ele) => ele,
131 | | None => break
132 | | };
133 | | loop {}
134 | | }
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.
2018-10-06 16:18:06 +00:00
--> $DIR/while_loop.rs:133:9
|
2018-10-06 16:18:06 +00:00
133 | loop {}
| ^^^^^^^
|
= note: `-D clippy::empty-loop` implied by `-D warnings`
error: this loop could be written as a `for` loop
2018-10-06 16:18:06 +00:00
--> $DIR/while_loop.rs:193:29
|
2018-10-06 16:18:06 +00:00
193 | while let Some(v) = y.next() { // use a for loop here
2018-01-29 04:18:11 +00:00
| ^^^^^^^^ help: try: `for v in y { .. }`
error: this loop could be written as a `for` loop
2018-10-06 16:18:06 +00:00
--> $DIR/while_loop.rs:220:26
|
2018-10-06 16:18:06 +00:00
220 | 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