Skip to content

Fix clone_on_copy not detecting derefs sometimes #3336

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

Merged
merged 2 commits into from
Dec 8, 2018

Conversation

HMPerson1
Copy link
Contributor

We could possibly assert that the necessary Deref impl actually exists before emitting the lint, but that seems unnecessary to me.

Fixes #3052

@oli-obk
Copy link
Contributor

oli-obk commented Oct 19, 2018

I agree with your analysis. There must be one, otherwise clone could not have been called.

Can you add more complex tests with multiple levels of derefs?

@HMPerson1
Copy link
Contributor Author

Oh, I hadn't thought about multiple levels of derefs. Currently this lint will definitely suggest the wrong thing in that case 😅. I'll fix that in a bit.

@phansch phansch merged commit 26602dd into rust-lang:master Dec 8, 2018
@phansch
Copy link
Member

phansch commented Dec 8, 2018

Thanks! (and sorry for letting this sit so long)

@HMPerson1 HMPerson1 deleted the clone_on_copy_deref branch December 10, 2018 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants