Skip to content

Remove redundant reference in closure with deref coercion#307

Open
semihbkgr wants to merge 1 commit into
rust-unofficial:masterfrom
semihbkgr:patch-1
Open

Remove redundant reference in closure with deref coercion#307
semihbkgr wants to merge 1 commit into
rust-unofficial:masterfrom
semihbkgr:patch-1

Conversation

@semihbkgr
Copy link
Copy Markdown

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