Closed
Description
What it does
Checks for iteration of Option
s with if let Some
inside. Can use flatten()
instead. The lint should also work in iter.for_each()
.
Categories (optional)
- Kind: complexity
What is the advantage of the recommended code over the original code
It is simpler.
Drawbacks
None.
Example
for x in y {
if let Some(z) = x {
println!("{}", z);
}
}
Could be written as:
for z in y.flatten() {
println!("{}", z);
}