aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_syntax/src/syntax_text.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/ra_syntax/src/syntax_text.rs b/crates/ra_syntax/src/syntax_text.rs
index e648dc082..939f2c02f 100644
--- a/crates/ra_syntax/src/syntax_text.rs
+++ b/crates/ra_syntax/src/syntax_text.rs
@@ -38,9 +38,7 @@ impl<'a> SyntaxText<'a> {
38 } 38 }
39 39
40 pub fn to_smol_string(&self) -> SmolStr { 40 pub fn to_smol_string(&self) -> SmolStr {
41 // FIXME: use `self.chunks().collect()` here too once 41 self.chunks().collect()
42 // https://github.com/matklad/smol_str/pull/12 is merged and published
43 self.to_string().into()
44 } 42 }
45 43
46 pub fn contains(&self, c: char) -> bool { 44 pub fn contains(&self, c: char) -> bool {
@@ -63,6 +61,10 @@ impl<'a> SyntaxText<'a> {
63 self.range.len() 61 self.range.len()
64 } 62 }
65 63
64 pub fn is_empty(&self) -> bool {
65 self.range.is_empty()
66 }
67
66 /// NB, the offsets here are absolute, and this probably doesn't make sense! 68 /// NB, the offsets here are absolute, and this probably doesn't make sense!
67 pub fn slice(&self, range: impl ops::RangeBounds<TextUnit>) -> SyntaxText<'a> { 69 pub fn slice(&self, range: impl ops::RangeBounds<TextUnit>) -> SyntaxText<'a> {
68 let start = match range.start_bound() { 70 let start = match range.start_bound() {