We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
find_map
find
Finds occurrences of find_map that could be simplified to find.
simplifiable_find_map(?)
complexity
Essentially the same benefits of the filter_next lint (in fact, this could perhaps be an enhancement of that lint).
filter_next
None(?).
pub fn main() { let xs = [0, 1, 2]; let odd = xs.iter().find_map(|x| if x % 2 == 1 { Some(x) } else { None }); println!("{:?}", odd); }
Could be written as:
pub fn main() { let xs = [0, 1, 2]; let odd = xs.iter().find(|x| *x % 2 == 1); println!("{:?}", odd); }
A tricky part could be that find's function argument expects a reference, but find's does not.
The text was updated successfully, but these errors were encountered:
unnecessary_find_map
6e211ea
Successfully merging a pull request may close this issue.
What it does
Finds occurrences of
find_map
that could be simplified tofind
.Lint Name
simplifiable_find_map(?)
Category
complexity
Advantage
Essentially the same benefits of the
filter_next
lint (in fact, this could perhaps be an enhancement of that lint).Drawbacks
None(?).
Example
Could be written as:
A tricky part could be that
find
's function argument expects a reference, butfind
's does not.The text was updated successfully, but these errors were encountered: