-
Notifications
You must be signed in to change notification settings - Fork 1.7k
assigning_clones causes infinite recursion when it triggers inside a clone_from()
impl
#12600
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
Comments
Yeah that's a good point, we shouldn't fire the lint inside actual |
I saw this happen a couple times in I'm wondering if there is a more general way to fix this, like "if we know we are going to suggest replacing code with a |
clone_form()
implclone_from()
impl
Currently the lint is set to applicability |
I've been doing this since more than 4 years 🤷 Now I can see that "impl inside libstd/libcore" is a bit of an edge case, however in this case it would also trigger for types that were declared inside the compiler, so this might aswell be a type inside your everyday rust crate that implements Clone and clonefrom. |
Summary
maybe we should skip everything that is either
self
or anything that is inside a impl offn clone_from()
?cc @Kobzol @blyxyas @kpreid
Reproducer
I tried this code:
I expected to see this happen:
Instead, this happened:
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: