-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
clippy::redundant_closure suggestion unnecessarily complicated #3974
Comments
I got this similar issue today:
Even though I do think redundant closures are bad, doing the change proposed by Clippy makes the code less readable imho. I don't really want to disable the rule since the use case in the following example is a valid one so I wish to keep it: xs.map(|x| foo(x)) Note: I cannot import Source code on: https://github.com/cecton/gptman/blob/d64b8c7a3403ddf2ee7bb5f864be88168b2f9d41/src/cli/commands.rs#L698 |
I'm not sure I prefer having |
The lint is old, but it did get smarter recently. It doesn't seem too good at picking strings for suggestions though. Might be worth splitting out the code dealing with methods as a separate lint |
@mitsuhiko I'm kind of in the same boat, I actually prefer Maybe it'd be possible to whitelist certain cases? |
Clippy rightfully suggests to simplify a
map
with aas_str ()
in the closure to usas_str
directly. However the given suggestion is a bit too complicated and verbose given that theString
module is always imported:It would be gread if the lint would say:
instead.
The version is:
The text was updated successfully, but these errors were encountered: