Skip to content

Conversation

Centri3
Copy link
Member

@Centri3 Centri3 commented Jun 11, 2023

Split off from #10788.

Closes #10700


changelog: new lint [incorrect_clone_impl_on_copy_type]
#10925

@rustbot
Copy link
Collaborator

rustbot commented Jun 11, 2023

r? @xFrednet

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 11, 2023
@xFrednet
Copy link
Contributor

@Centri3, you're on a real PR creation spree, damn! I'll review this one over the coming week :D

@bors
Copy link
Contributor

bors commented Jun 12, 2023

☔ The latest upstream changes (presumably #10921) made this pull request unmergeable. Please resolve the merge conflicts.

@Centri3 Centri3 force-pushed the needless_clone_impl2 branch from 0f41cf7 to c711242 Compare June 12, 2023 08:23
@bors
Copy link
Contributor

bors commented Jun 12, 2023

☔ The latest upstream changes (presumably #10916) made this pull request unmergeable. Please resolve the merge conflicts.

@Centri3 Centri3 force-pushed the needless_clone_impl2 branch from c711242 to bb07da0 Compare June 12, 2023 10:36
@bors
Copy link
Contributor

bors commented Jun 12, 2023

☔ The latest upstream changes (presumably #10827) made this pull request unmergeable. Please resolve the merge conflicts.

@Centri3 Centri3 force-pushed the needless_clone_impl2 branch from bb07da0 to e0d1ec4 Compare June 12, 2023 17:49
Copy link
Contributor

@xFrednet xFrednet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few smaller comments, but all of them should hopefully be simple to solve :). Please reach out, if you have any questions :)

@bors
Copy link
Contributor

bors commented Jun 15, 2023

☔ The latest upstream changes (presumably #10934) made this pull request unmergeable. Please resolve the merge conflicts.

@Centri3 Centri3 force-pushed the needless_clone_impl2 branch from c38620d to 10cc168 Compare June 15, 2023 12:05
@Centri3
Copy link
Member Author

Centri3 commented Jun 15, 2023

I've looked at ryu's emittance of this lint, and it appears it is indeed correct; it implements Copy but Clone calls Buffer::new.
https://github.com/dtolnay/ryu/blob/6cdb3d1a0aaf62f762acf391d6b03f9a41f56c0e/src/buffer/mod.rs#LL82C1-L89C2
I've tested it with *self instead and there's no difference.

Running miri as well shows nothing out of the ordinary (though it already reported a violation of stacked borrows without such a change). Not sure whether it's slower or not, though.

@xFrednet xFrednet changed the title add lint [needless_clone_impl] add lint [incorrect_clone_impl_on_copy_type] Jun 16, 2023
@xFrednet
Copy link
Contributor

This looks good to me. Thank you for the new lint!

@bors r+

@bors
Copy link
Contributor

bors commented Jun 16, 2023

📌 Commit 10cc168 has been approved by xFrednet

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jun 16, 2023

⌛ Testing commit 10cc168 with merge 87b5f89...

@bors
Copy link
Contributor

bors commented Jun 16, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: xFrednet
Pushing 87b5f89 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clone should be *self for types which are always Copy
4 participants