| ### What it does | |
| Check for unnecessary `if let` usage in a for loop | |
| where only the `Some` or `Ok` variant of the iterator element is used. | |
| ### Why is this bad? | |
| It is verbose and can be simplified | |
| by first calling the `flatten` method on the `Iterator`. | |
| ### Example | |
| ``` | |
| let x = vec![Some(1), Some(2), Some(3)]; | |
| for n in x { | |
| if let Some(n) = n { | |
| println!("{}", n); | |
| } | |
| } | |
| ``` | |
| Use instead: | |
| ``` | |
| let x = vec![Some(1), Some(2), Some(3)]; | |
| for n in x.into_iter().flatten() { | |
| println!("{}", n); | |
| } | |
| ``` |