diff --git a/crates/libsyntax2/src/yellow/green.rs b/crates/libsyntax2/src/yellow/green.rs index 59aefb0def..dc3186a245 100644 --- a/crates/libsyntax2/src/yellow/green.rs +++ b/crates/libsyntax2/src/yellow/green.rs @@ -43,10 +43,6 @@ impl GreenNode { } } - pub fn leaf_text(&self) -> Option { - self.leaf_text_ref().map(Clone::clone) - } - pub fn leaf_text_ref(&self) -> Option<&SmolStr> { match self { GreenNode::Leaf { text, .. } => Some(text), diff --git a/crates/libsyntax2/src/yellow/syntax.rs b/crates/libsyntax2/src/yellow/syntax.rs index ede9ad3c8f..444dbeb309 100644 --- a/crates/libsyntax2/src/yellow/syntax.rs +++ b/crates/libsyntax2/src/yellow/syntax.rs @@ -153,7 +153,7 @@ impl SyntaxNode { } pub fn leaf_text(&self) -> Option { - self.red().green().leaf_text() + self.borrowed().leaf_text_ref().map(|it| it.clone()) } pub(crate) fn replace_with(&self, green: GreenNode) -> GreenNode {