-
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
redundant_clone in Rc context ? #4982
Comments
The lint is implemented in
Since @sinkuu completely rewrote this lint, maybe he can give a little bit more insight. For how to write tests in Clippy, you can read this part of the documentation: https://github.com/rust-lang/rust-clippy/blob/master/doc/adding_lints.md#testing |
The type of the value being
I think |
Pretty cool I'll try to work on it tomorrow or next week :D
Would it make sense to create a redundant_rc_clone.rs file ? |
Do you mean to suggest (I don't see the point in doing so though. I was thinking of a lint that replaces all |
That's what I initially thought of but the lint you mention (replacing rc.clone() with Rc::clone(&rc)) would be a great improvement IMO, it would make things explicit, and still allow redundant_clone to do its job in RC context. I'm however not aware of the actual process to discuss a new lint and create a consensus among the clippy contributors ^^'. |
You can do 2 things:
If you decide to do (2.) and need any help with that, just ask here or open a WIP PR :) About the consensus: If people disagree with the lint, we can still move it to a |
I would love to try to implement it myself ! I have a couple of things to finish before I tackle it though, but feel free to assign me to it :) |
|
We had a small discussion on it here: mozilla/neqo#374 (comment).
I wonder if we could tell a user to use
Rc::clone(&foo)
if the linter warns about a redundant clone in Rc context ?If so I would love to work on it, but that would be my first PR to clippy, so it would probably require someone to mentor me.
Thanks for your time :)
The text was updated successfully, but these errors were encountered: