Skip to content

Commit

Permalink
Rollup merge of #77399 - ssomers:btree_cleanup_5, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
BTreeMap: use Unique::from to avoid a cast where type information exists

r? @Mark-Simulacrum
  • Loading branch information
JohnTitor authored Oct 1, 2020
2 parents fbb3dd4 + 4243475 commit c820a52
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/alloc/src/collections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl<K, V> BoxedNode<K, V> {
}

fn from_internal(node: Box<InternalNode<K, V>>) -> Self {
BoxedNode { ptr: Box::into_unique(node).cast() }
BoxedNode { ptr: Unique::from(&mut Box::leak(node).data) }
}

unsafe fn from_ptr(ptr: NonNull<LeafNode<K, V>>) -> Self {
Expand Down

0 comments on commit c820a52

Please sign in to comment.