Skip to content
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

Use tx.clone() instead of mpsc::Sender::clone(&tx) #1936

Closed
wants to merge 1 commit into from
Closed

Use tx.clone() instead of mpsc::Sender::clone(&tx) #1936

wants to merge 1 commit into from

Conversation

joekyo
Copy link

@joekyo joekyo commented Apr 26, 2019

Both forms are same, but tx.clone() is more concise.

@steveklabnik
Copy link
Member

I believe that this is due to a clippy lint: https://rust-lang.github.io/rust-clippy/master/#clone_on_ref_ptr

@carols10cents , opinions?

@carols10cents
Copy link
Member

Yep, this style is deliberate to show that this call of clone is cheap. See d0abf1f and #729. We explain this in Chapter 15 (search for "We could have called a.clone() rather than Rc::clone(&a)"). Thanks!

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