What it does
Checks for iteration of Options with if let Some inside. Can use flatten() instead. The lint should also work in iter.for_each().
Categories (optional)
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);
}
What it does
Checks for iteration of
Options withif let Someinside. Can useflatten()instead. The lint should also work initer.for_each().Categories (optional)
What is the advantage of the recommended code over the original code
It is simpler.
Drawbacks
None.
Example
Could be written as: