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

Improve documentation for suspicious_map #4793

Closed
jonasbb opened this issue Nov 8, 2019 · 0 comments · Fixed by #5070
Closed

Improve documentation for suspicious_map #4793

jonasbb opened this issue Nov 8, 2019 · 0 comments · Fixed by #5070
Labels
A-documentation Area: Adding or improving documentation

Comments

@jonasbb
Copy link

jonasbb commented Nov 8, 2019

The error message for `` only mentions one possible case, that somebody confused map with `filter`.

Another likely cause is that the code predates Iterator::for_each. It was common to use count to drive the iterator to completion. It would be helpful if that case could be added to the error message, as the hit with filter confused me more than it helped.

This is the current error message of Rust stable 1.39.

error: this call to `map()` won't have an effect on the call to `count()`
    |
    | /         batches
    | |             .iter()
    | |             .map(|batch| {
    | |                 match batch {
...   |
    | |             })
    | |             .count();
    | |____________________^
    |
    = note: `-D clippy::suspicious-map` implied by `-D warnings`
    = help: make sure you did not confuse `map` with `filter`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documentation Area: Adding or improving documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants