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

Remove redundant reference in closure with deref coercion #307

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

semihbkgr
Copy link

In the explanation of deref coercion and turbofish, the &node introduces an extra level of indirection by taking a reference to &Node<T>. Since Rust's deref coercion can handle this automatically, the closure can be simplified to |node| node, allowing Rust to directly dereference the Box and return &Node<T>. I’m unsure whether this was added intentionally, but it was a part that confused me while reading.

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.

1 participant