aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/yellow/syntax_text.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/yellow/syntax_text.rs')
-rw-r--r--crates/ra_syntax/src/yellow/syntax_text.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/crates/ra_syntax/src/yellow/syntax_text.rs b/crates/ra_syntax/src/yellow/syntax_text.rs
index 378cd1b2e..84e5b231a 100644
--- a/crates/ra_syntax/src/yellow/syntax_text.rs
+++ b/crates/ra_syntax/src/yellow/syntax_text.rs
@@ -10,10 +10,7 @@ pub struct SyntaxText<'a> {
10 10
11impl<'a> SyntaxText<'a> { 11impl<'a> SyntaxText<'a> {
12 pub(crate) fn new(node: &'a SyntaxNode) -> SyntaxText<'a> { 12 pub(crate) fn new(node: &'a SyntaxNode) -> SyntaxText<'a> {
13 SyntaxText { 13 SyntaxText { node, range: node.range() }
14 node,
15 range: node.range(),
16 }
17 } 14 }
18 15
19 pub fn chunks(&self) -> impl Iterator<Item = &'a str> { 16 pub fn chunks(&self) -> impl Iterator<Item = &'a str> {
@@ -58,10 +55,7 @@ impl<'a> SyntaxText<'a> {
58 let range = range.restrict(self.range).unwrap_or_else(|| { 55 let range = range.restrict(self.range).unwrap_or_else(|| {
59 panic!("invalid slice, range: {:?}, slice: {:?}", self.range, range) 56 panic!("invalid slice, range: {:?}, slice: {:?}", self.range, range)
60 }); 57 });
61 SyntaxText { 58 SyntaxText { node: self.node, range }
62 node: self.node,
63 range,
64 }
65 } 59 }
66 60
67 pub fn char_at(&self, offset: impl Into<TextUnit>) -> Option<char> { 61 pub fn char_at(&self, offset: impl Into<TextUnit>) -> Option<char> {