-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
A-lintArea: New lintsArea: New lintsL-complexityLint: Belongs in the complexity lint groupLint: Belongs in the complexity lint groupgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
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);
}
pickfire
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsL-complexityLint: Belongs in the complexity lint groupLint: Belongs in the complexity lint groupgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy