new lint: find unneccessary Some(x).and_then(|y| Some(y ..)) #6472
Labels
A-lint
Area: New lints
good-first-issue
These issues are a good way to get started with Clippy
L-complexity
Lint: Belongs in the complexity lint group
What it does
Catch
Some(..).and_then(|..| Some(..))
patterns.What does this lint do?
Suggest to simplify the statement to
Some(do something with x and y)
For example
Some(3).and_then(|x| Some(x+4));
could be simplified toSome(3+4)
Categories (optional)
Complexity, maybe pedantic.
What is the advantage of the recommended code over the original code
It's way easier to understand
Drawbacks
None.
Example
Could be written as:
The text was updated successfully, but these errors were encountered: