Skip to content
New issue

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

new lint: map().count() on iterator #4010

Closed
matthiaskrgr opened this issue Apr 19, 2019 · 0 comments · Fixed by #4394
Closed

new lint: map().count() on iterator #4010

matthiaskrgr opened this issue Apr 19, 2019 · 0 comments · Fixed by #4394
Labels
A-lint Area: New lints L-complexity Lint: Belongs in the complexity lint group

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Apr 19, 2019

x.iter().map(|x| some_function(x)).count()

This looks suspicious, especially if some_function returns bool.
In this case, maybe the user wanted to use filter() instead of map()?
Otherwise the map might still be redundant (if some_function() does not have side effects...).

@matthiaskrgr matthiaskrgr added the A-lint Area: New lints label Apr 19, 2019
@oli-obk oli-obk added the L-complexity Lint: Belongs in the complexity lint group label Apr 24, 2019
@bors bors closed this as completed in b233685 Aug 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints L-complexity Lint: Belongs in the complexity lint group
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants