}
// Test for loop over an implicit reference
- // Note: If `clippy::manual_flatten` is made autofixable, this case will
+ // Note: if `clippy::manual_flatten` is made autofixable, this case will
// lead to a follow-up lint `clippy::into_iter_on_ref`
let z = &y;
for n in z {
}
// Using the `None` variant should not trigger the lint
+ // Note: for an autofixable suggestion, the binding in the for loop has to take the
+ // name of the binding in the `if let`
let z = vec![Some(1), Some(2), Some(3)];
for n in z {
if n.is_none() {
| |_____^
|
= note: `-D clippy::manual-flatten` implied by `-D warnings`
-help: also remove the `if let` statement in the for loop
+help: ...and remove the `if let` statement in the for loop
--> $DIR/manual_flatten.rs:7:9
|
LL | / if let Some(y) = n {
LL | | }
| |_____^
|
-help: also remove the `if let` statement in the for loop
+help: ...and remove the `if let` statement in the for loop
--> $DIR/manual_flatten.rs:15:9
|
LL | / if let Ok(n) = n {
LL | | }
| |_____^
|
-help: also remove the `if let` statement in the for loop
+help: ...and remove the `if let` statement in the for loop
--> $DIR/manual_flatten.rs:22:9
|
LL | / if let Ok(n) = n {
LL | | }
| |_____^
|
-help: also remove the `if let` statement in the for loop
+help: ...and remove the `if let` statement in the for loop
--> $DIR/manual_flatten.rs:32:9
|
LL | / if let Ok(n) = n {
LL | | }
| |_____^
|
-help: also remove the `if let` statement in the for loop
+help: ...and remove the `if let` statement in the for loop
--> $DIR/manual_flatten.rs:41:9
|
LL | / if let Some(m) = n {