summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/for_loops_over_fallibles.stderr
blob: 8c8c022243aeb8c47b5826fb4ba0f9e922c902ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement
  --> $DIR/for_loops_over_fallibles.rs:9:14
   |
LL |     for x in option {
   |              ^^^^^^
   |
   = note: `-D clippy::for-loops-over-fallibles` implied by `-D warnings`
   = help: consider replacing `for x in option` with `if let Some(x) = option`

error: for loop over `option`, which is an `Option`. This is more readably written as an `if let` statement
  --> $DIR/for_loops_over_fallibles.rs:14:14
   |
LL |     for x in option.iter() {
   |              ^^^^^^
   |
   = help: consider replacing `for x in option.iter()` with `if let Some(x) = option`

error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
  --> $DIR/for_loops_over_fallibles.rs:19:14
   |
LL |     for x in result {
   |              ^^^^^^
   |
   = help: consider replacing `for x in result` with `if let Ok(x) = result`

error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
  --> $DIR/for_loops_over_fallibles.rs:24:14
   |
LL |     for x in result.iter_mut() {
   |              ^^^^^^
   |
   = help: consider replacing `for x in result.iter_mut()` with `if let Ok(x) = result`

error: for loop over `result`, which is a `Result`. This is more readably written as an `if let` statement
  --> $DIR/for_loops_over_fallibles.rs:29:14
   |
LL |     for x in result.into_iter() {
   |              ^^^^^^
   |
   = help: consider replacing `for x in result.into_iter()` with `if let Ok(x) = result`

error: for loop over `option.ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement
  --> $DIR/for_loops_over_fallibles.rs:33:14
   |
LL |     for x in option.ok_or("x not found") {
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider replacing `for x in option.ok_or("x not found")` with `if let Ok(x) = option.ok_or("x not found")`

error: you are iterating over `Iterator::next()` which is an Option; this will compile but is probably not what you want
  --> $DIR/for_loops_over_fallibles.rs:39:14
   |
LL |     for x in v.iter().next() {
   |              ^^^^^^^^^^^^^^^
   |
   = note: `#[deny(clippy::iter_next_loop)]` on by default

error: for loop over `v.iter().next().and(Some(0))`, which is an `Option`. This is more readably written as an `if let` statement
  --> $DIR/for_loops_over_fallibles.rs:44:14
   |
LL |     for x in v.iter().next().and(Some(0)) {
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider replacing `for x in v.iter().next().and(Some(0))` with `if let Some(x) = v.iter().next().and(Some(0))`

error: for loop over `v.iter().next().ok_or("x not found")`, which is a `Result`. This is more readably written as an `if let` statement
  --> $DIR/for_loops_over_fallibles.rs:48:14
   |
LL |     for x in v.iter().next().ok_or("x not found") {
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: consider replacing `for x in v.iter().next().ok_or("x not found")` with `if let Ok(x) = v.iter().next().ok_or("x not found")`

error: this loop never actually loops
  --> $DIR/for_loops_over_fallibles.rs:60:5
   |
LL | /     while let Some(x) = option {
LL | |         println!("{}", x);
LL | |         break;
LL | |     }
   | |_____^
   |
   = note: `#[deny(clippy::never_loop)]` on by default

error: this loop never actually loops
  --> $DIR/for_loops_over_fallibles.rs:66:5
   |
LL | /     while let Ok(x) = result {
LL | |         println!("{}", x);
LL | |         break;
LL | |     }
   | |_____^

error: aborting due to 11 previous errors