From 288c9d1ac625c4fa451bdb8ff54830fb9f9795e0 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 28 Aug 2018 14:07:41 +0300 Subject: Simplify API --- crates/libsyntax2/src/yellow/green.rs | 4 ---- crates/libsyntax2/src/yellow/syntax.rs | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'crates/libsyntax2/src') diff --git a/crates/libsyntax2/src/yellow/green.rs b/crates/libsyntax2/src/yellow/green.rs index 59aefb0de..dc3186a24 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 ede9ad3c8..444dbeb30 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 { -- cgit v1.2.3