diff --git a/src/yellow/red.rs b/src/yellow/red.rs index e0fa27e5f7bf..3f0ddd04cf70 100644 --- a/src/yellow/red.rs +++ b/src/yellow/red.rs @@ -11,7 +11,7 @@ use { pub(crate) struct RedNode { green: GreenNode, parent: Option, - children: RwLock>>>, + children: RwLock>>, } #[derive(Debug)] @@ -68,7 +68,7 @@ impl RedNode { pub(crate) fn nth_child(&self, idx: usize) -> ptr::NonNull { match &self.children.read().unwrap()[idx] { - Some(child) => return ptr::NonNull::from(&**child), + Some(child) => return child.into(), None => (), } let mut children = self.children.write().unwrap(); @@ -77,10 +77,10 @@ impl RedNode { let start_offset = self.start_offset() + green_children[..idx].iter().map(|x| x.text_len()).sum::(); let child = RedNode::new_child(green_children[idx].clone(), self.into(), start_offset, idx); - children[idx] = Some(Box::new(child)) + children[idx] = Some(child) } - let child = children[idx].as_ref().unwrap(); - ptr::NonNull::from(&**child) + children[idx].as_ref().unwrap().into() + } pub(crate) fn parent(&self) -> Option> {