From 424347527dca62e648425298838e6b6bca095c9f Mon Sep 17 00:00:00 2001 From: Stein Somers Date: Sat, 26 Sep 2020 20:49:22 +0200 Subject: [PATCH] BTreeMap: use Unique::from to avoid a cast where type information exists --- library/alloc/src/collections/btree/node.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/alloc/src/collections/btree/node.rs b/library/alloc/src/collections/btree/node.rs index c3f27c105994f..ba08f65f903e5 100644 --- a/library/alloc/src/collections/btree/node.rs +++ b/library/alloc/src/collections/btree/node.rs @@ -128,7 +128,7 @@ impl BoxedNode { } fn from_internal(node: Box>) -> Self { - BoxedNode { ptr: Box::into_unique(node).cast() } + BoxedNode { ptr: Unique::from(&mut Box::leak(node).data) } } unsafe fn from_ptr(ptr: NonNull>) -> Self {