summaryrefslogtreecommitdiff
path: root/rust/kernel/rbtree.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/kernel/rbtree.rs')
-rw-r--r--rust/kernel/rbtree.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/rust/kernel/rbtree.rs b/rust/kernel/rbtree.rs
index 48ceb9560bf5..25eb36fd1cdc 100644
--- a/rust/kernel/rbtree.rs
+++ b/rust/kernel/rbtree.rs
@@ -1059,15 +1059,14 @@ impl<K, V> RBTreeNodeReservation<K, V> {
/// Initialises a node reservation.
///
/// It then becomes an [`RBTreeNode`] that can be inserted into a tree.
- pub fn into_node(self, key: K, value: V) -> RBTreeNode<K, V> {
- let node = Box::write(
- self.node,
- Node {
- key,
- value,
- links: bindings::rb_node::default(),
- },
- );
+ pub fn into_node(mut self, key: K, value: V) -> RBTreeNode<K, V> {
+ self.node.write(Node {
+ key,
+ value,
+ links: bindings::rb_node::default(),
+ });
+ // SAFETY: We just wrote to it.
+ let node = unsafe { self.node.assume_init() };
RBTreeNode { node }
}
}