Rollup merge of #77399 - ssomers:btree_cleanup_5, r=Mark-Simulacrum

BTreeMap: use Unique::from to avoid a cast where type information exists

r? @Mark-Simulacrum
This commit is contained in:
Yuki Okushi 2020-10-02 08:25:25 +09:00 committed by GitHub
commit c820a522ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {