-
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
False positive with redundant_closure and Deref #3942
Comments
Just to add to this, I saw a similar problem yesterday and posted about it in the clippy discord channel. Gonna copy paste the convo ag_dubsToday at 1:02 PM
original source let screens = system.get_process_by_name("SCREEN");
screens
.iter()
.map(|p| p.cmd())
... with suggestion
using the properly exported path use sysinfo::{ProcessExt, SystemExt};
...
.map(ProcessExt::cmd) which still doesn't work because the signature doesn't expect the level of reference this iterator uses screens
.into_iter()
.map(ProcessExt::cmd) |
We are seeing the same on this diesel PR.
Applying the suggestion does not work because the iterator yields a |
Even when it works I'm not sure that the suggestion are actually a good idea. I don't think it makes the code more readable by using the associated methods. |
(I think if you don't like it you should disable it, disabling it for everyone requires a stronger argument) |
As mentioned in the other issue, one path forward may be to split out the one that deals with methods into a pedantic lint. That seems more controversial than the main lint. |
…=Manishearth Split redundant_closure lint Move the method checking into a new lint called `redundant_closures_for_method_calls` and put it in the pedantic group. This aspect of the lint seems more controversial than the rest. cc #3942 changelog: Move method checking from `redundant_closure` to a new `pedantic` lint called `redundant_closures_for_method_calls`.
…=Manishearth Split redundant_closure lint Move the method checking into a new lint called `redundant_closures_for_method_calls` and put it in the pedantic group. This aspect of the lint seems more controversial than the rest. cc #3942 changelog: Move method checking from `redundant_closure` to a new `pedantic` lint called `redundant_closure_for_method_calls`.
…=Manishearth Split redundant_closure lint Move the method checking into a new lint called `redundant_closures_for_method_calls` and put it in the pedantic group. This aspect of the lint seems more controversial than the rest. cc #3942 changelog: Move method checking from `redundant_closure` to a new `pedantic` lint called `redundant_closure_for_method_calls`.
…=Manishearth Split redundant_closure lint Move the method checking into a new lint called `redundant_closures_for_method_calls` and put it in the pedantic group. This aspect of the lint seems more controversial than the rest. cc #3942 changelog: Move method checking from `redundant_closure` to a new `pedantic` lint called `redundant_closure_for_method_calls`.
Closing as this was fixed by #4191 |
The new Clippy in 1.34 makes a suggestion that doesn't work:
You can't remove the closure since
ToString::to_string
won't deref the Foo to a &str.The text was updated successfully, but these errors were encountered: