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
Uplift clippy::clone_double_ref
to rustc
#109451
Comments
Personally this seems good, but I think I'd actually rather get @rust-lang/libs-api's take on it, rather than lang. Do you consider this a reasonable use of Also, I wonder if this is something that would make more sense as an attribute on the |
I support uplifting this. I've hit the same issue repeatedly too; it is covered in https://dtolnay.github.io/rust-quiz/30. |
From a beginner's perspective,
For additional clarity, I would suggest something more like:
|
This issue briefly came up in the libs-api meeting.
Yes, this seems like a very useful lint to us. :) |
This is done as |
In #109429, a snippet of code involves cloning references outputted a confusing compiler error:
Changing the diagnostic to provide help when we are trying to use a function that takes
self
after a.clone()
call is nontrivial, since this is MIR borrowck and to my knowledge it is hard to know if it comes from the return value of a.clone()
call.Ideally we should have an error/warning like the one from clippy:
I think there are other ways this can be confusing, so uplifting can help with many issues related to this and not just the example I linked.
cc @rust-lang/lang: would uplifting be a good idea? I'd be willing to work on this if this gets approval.
@rustbot label +A-lint +T-compiler +T-lang +D-newcomer-roadblock
The text was updated successfully, but these errors were encountered: