@@ -97,5 +97,65 @@ help: consider using `if let` to clear intent
97
97
LL | if let Ok(_) = Ok::<_, ()>([0; 0]) {}
98
98
| ~~~~~~~~~~ ~~~
99
99
100
- warning: 6 warnings emitted
100
+ warning: for loop over an `&Option`. This is more readably written as an `if let` statement
101
+ --> $DIR/for_loop_over_fallibles.rs:47:14
102
+ |
103
+ LL | for _ in &Some(1) {}
104
+ | ^^^^^^^^
105
+ |
106
+ help: to check pattern in a loop use `while let`
107
+ |
108
+ LL | while let Some(_) = &Some(1) {}
109
+ | ~~~~~~~~~~~~~~~ ~~~
110
+ help: consider using `if let` to clear intent
111
+ |
112
+ LL | if let Some(_) = &Some(1) {}
113
+ | ~~~~~~~~~~~~ ~~~
114
+
115
+ warning: for loop over a `&Result`. This is more readably written as an `if let` statement
116
+ --> $DIR/for_loop_over_fallibles.rs:51:14
117
+ |
118
+ LL | for _ in &Ok::<_, ()>(1) {}
119
+ | ^^^^^^^^^^^^^^^
120
+ |
121
+ help: to check pattern in a loop use `while let`
122
+ |
123
+ LL | while let Ok(_) = &Ok::<_, ()>(1) {}
124
+ | ~~~~~~~~~~~~~ ~~~
125
+ help: consider using `if let` to clear intent
126
+ |
127
+ LL | if let Ok(_) = &Ok::<_, ()>(1) {}
128
+ | ~~~~~~~~~~ ~~~
129
+
130
+ warning: for loop over an `&mut Option`. This is more readably written as an `if let` statement
131
+ --> $DIR/for_loop_over_fallibles.rs:57:14
132
+ |
133
+ LL | for _ in &mut Some(1) {}
134
+ | ^^^^^^^^^^^^
135
+ |
136
+ help: to check pattern in a loop use `while let`
137
+ |
138
+ LL | while let Some(_) = &mut Some(1) {}
139
+ | ~~~~~~~~~~~~~~~ ~~~
140
+ help: consider using `if let` to clear intent
141
+ |
142
+ LL | if let Some(_) = &mut Some(1) {}
143
+ | ~~~~~~~~~~~~ ~~~
144
+
145
+ warning: for loop over a `&mut Result`. This is more readably written as an `if let` statement
146
+ --> $DIR/for_loop_over_fallibles.rs:61:14
147
+ |
148
+ LL | for _ in &mut Ok::<_, ()>(1) {}
149
+ | ^^^^^^^^^^^^^^^^^^^
150
+ |
151
+ help: to check pattern in a loop use `while let`
152
+ |
153
+ LL | while let Ok(_) = &mut Ok::<_, ()>(1) {}
154
+ | ~~~~~~~~~~~~~ ~~~
155
+ help: consider using `if let` to clear intent
156
+ |
157
+ LL | if let Ok(_) = &mut Ok::<_, ()>(1) {}
158
+ | ~~~~~~~~~~ ~~~
159
+
160
+ warning: 10 warnings emitted
101
161
0 commit comments