aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/yellow/red.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/yellow/red.rs b/src/yellow/red.rs
index e0fa27e5f..3f0ddd04c 100644
--- a/src/yellow/red.rs
+++ b/src/yellow/red.rs
@@ -11,7 +11,7 @@ use {
11pub(crate) struct RedNode { 11pub(crate) struct RedNode {
12 green: GreenNode, 12 green: GreenNode,
13 parent: Option<ParentData>, 13 parent: Option<ParentData>,
14 children: RwLock<Vec<Option<Box<RedNode>>>>, 14 children: RwLock<Vec<Option<RedNode>>>,
15} 15}
16 16
17#[derive(Debug)] 17#[derive(Debug)]
@@ -68,7 +68,7 @@ impl RedNode {
68 68
69 pub(crate) fn nth_child(&self, idx: usize) -> ptr::NonNull<RedNode> { 69 pub(crate) fn nth_child(&self, idx: usize) -> ptr::NonNull<RedNode> {
70 match &self.children.read().unwrap()[idx] { 70 match &self.children.read().unwrap()[idx] {
71 Some(child) => return ptr::NonNull::from(&**child), 71 Some(child) => return child.into(),
72 None => (), 72 None => (),
73 } 73 }
74 let mut children = self.children.write().unwrap(); 74 let mut children = self.children.write().unwrap();
@@ -77,10 +77,10 @@ impl RedNode {
77 let start_offset = self.start_offset() 77 let start_offset = self.start_offset()
78 + green_children[..idx].iter().map(|x| x.text_len()).sum::<TextUnit>(); 78 + green_children[..idx].iter().map(|x| x.text_len()).sum::<TextUnit>();
79 let child = RedNode::new_child(green_children[idx].clone(), self.into(), start_offset, idx); 79 let child = RedNode::new_child(green_children[idx].clone(), self.into(), start_offset, idx);
80 children[idx] = Some(Box::new(child)) 80 children[idx] = Some(child)
81 } 81 }
82 let child = children[idx].as_ref().unwrap(); 82 children[idx].as_ref().unwrap().into()
83 ptr::NonNull::from(&**child) 83
84 } 84 }
85 85
86 pub(crate) fn parent(&self) -> Option<ptr::NonNull<RedNode>> { 86 pub(crate) fn parent(&self) -> Option<ptr::NonNull<RedNode>> {