-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
suspicious_map
ignores side effects
#7767
Comments
I sadly don't see an easy way to fix this without creating a bunch of false negatives. I would also consider this lint to be correct here. Is there a reason why you used |
I already thought that I might be missing a more appropriate method, but I figured it's still an issue since it should be mentioned. So I agree that it can be just an documentation edit. I'll open a pull request, or? |
It would be awesome if you could create a PR. 🙃 The description can be found here: rust-clippy/clippy_lints/src/methods/mod.rs Lines 1281 to 1297 in abe551e
|
improved help message for `suspicious_map` `suspicious_map`'s help message assumes that the literal behavior is never the intended one, although it's sometimes. This PR adds a mention of `inspect`, offering a idiomatic alternative. fixes #7767 --- * Improved help message of [`suspicious_map`]. changelog:
suspicious_map
ignores possible side effects of the map. That was already mentioned #5253 and fixed, but only if it mutates something and not other kinds of side effects.Lint name:
suspicious_map
I tried this code:
I expected to see this happen: No clippy warnings.
Instead, this happened: I got the following warning and wrong suggestions:
Meta
Rust version (
rustc -Vv
):The text was updated successfully, but these errors were encountered: