diff options
author | Aleksey Kladov <[email protected]> | 2018-08-28 12:07:41 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-28 12:07:41 +0100 |
commit | 288c9d1ac625c4fa451bdb8ff54830fb9f9795e0 (patch) | |
tree | 724b013071f59d4d5fe698edf5892a54a586f12f /crates/libsyntax2/src/yellow | |
parent | 7e74af32268f9b0783ca94107b0b10d52e4ebe5e (diff) |
Simplify API
Diffstat (limited to 'crates/libsyntax2/src/yellow')
-rw-r--r-- | crates/libsyntax2/src/yellow/green.rs | 4 | ||||
-rw-r--r-- | crates/libsyntax2/src/yellow/syntax.rs | 2 |
2 files changed, 1 insertions, 5 deletions
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 { | |||
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
46 | pub fn leaf_text(&self) -> Option<SmolStr> { | ||
47 | self.leaf_text_ref().map(Clone::clone) | ||
48 | } | ||
49 | |||
50 | pub fn leaf_text_ref(&self) -> Option<&SmolStr> { | 46 | pub fn leaf_text_ref(&self) -> Option<&SmolStr> { |
51 | match self { | 47 | match self { |
52 | GreenNode::Leaf { text, .. } => Some(text), | 48 | 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<R: TreeRoot> SyntaxNode<R> { | |||
153 | } | 153 | } |
154 | 154 | ||
155 | pub fn leaf_text(&self) -> Option<SmolStr> { | 155 | pub fn leaf_text(&self) -> Option<SmolStr> { |
156 | self.red().green().leaf_text() | 156 | self.borrowed().leaf_text_ref().map(|it| it.clone()) |
157 | } | 157 | } |
158 | 158 | ||
159 | pub(crate) fn replace_with(&self, green: GreenNode) -> GreenNode { | 159 | pub(crate) fn replace_with(&self, green: GreenNode) -> GreenNode { |