Skip to content

Fix some clippy warnings#17

Open
ssbl wants to merge 1 commit into
kinghajj:masterfrom
ssbl:clippy-fixes
Open

Fix some clippy warnings#17
ssbl wants to merge 1 commit into
kinghajj:masterfrom
ssbl:clippy-fixes

Conversation

@ssbl
Copy link
Copy Markdown

@ssbl ssbl commented Oct 23, 2017

No description provided.

Comment thread src/lib.rs
impl<T: Send> Clone for Stealer<T> {
fn clone(&self) -> Self {
Stealer { deque: self.deque.clone() }
Stealer { deque: Arc::clone(&self.deque) }
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What's the reasoning given for this change?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I remember reading this section from the docs: https://doc.rust-lang.org/std/sync/struct.Arc.html#cloning-references

The Arc::clone(&from) syntax is the most idiomatic because it conveys more explicitly the meaning of the code. In the example above, this syntax makes it easier to see that this code is creating a new reference rather than copying the whole content of foo.

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.

2 participants