-
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
must_use_candidate is going mad (false positives?) #4779
Comments
|
@flip1995 yup, I understand that. However, I live with But this new It triggers almost any
even borrowing of trivial stuff:
Almost any getter methods:
It seems like with such behavior, the I don't know at which level Clippy operates and whether it has access to such information, but maybe we can skip trait implementations and issue warning for a trait itself? |
Yeah I agree with that. But we don't really have a category for that.
Yes this should be done. cc @llogiq what do you think about this? |
Does it makes sense to make the suggestion for functions? You might mistake a method call as mutating due to autorefs but with a function you typically have to pass the arguments as references so it's harder to make that mistake. As far as I know, in rustc they have only added |
no more must-use-candidate impls This should help with #4779.
no more must-use-candidate impls This should help with #4779. changelog: don't trigger [`must_use_candidate`] on trait impls
I also believe this is getting triggered by having an impl method that takes ownership. While this would normally be a good thing, having it not do so on |
It should probably not trigger on non-exported methods. I'm getting hundreds of |
Ok, I can add a visibility check. |
Maybe it would also make sense to keep the version that warns on every
candidate function as a different lint, that must be opt-in. I’m not sure
how useful that would be, but might be worth considering.
|
Lint only exported must_use_candidates As promised on #4779, here's the check for publicly visible items for `must_use_candidate` changelog: none
Since it's not explicitly mentioned here yet: According to the documentation:
So |
Do you have an example where the lint is triggered in a trait impl? I ask.because the UI test has an example where it isn't. |
@llogiq, I don't, I just saw that tyranron mentioned this:
And there was no mention about this (or I missed it) in the conversation. Happy to hear that it seems to work! |
@llogiq it seems that this issue can be closed now. I don't feel a big tension with this lint in latest releases. Thank you for taking care! |
With the latest Rust beta release:
must_use_candidate
lint complains about every single function in my code.Is it an intended behavior or just a false positives bug? It has worked OK on previous version.
The text was updated successfully, but these errors were encountered: