Skip to content

Commit 51dd614

Browse files
committed
BTreeMap: use Unique::from to avoid a cast where type information exists
1 parent f758585 commit 51dd614

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

alloc/src/collections/btree/node.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<K, V> BoxedNode<K, V> {
128128
}
129129

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

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

0 commit comments

Comments
 (0)