diff --git a/crates/ra_syntax/src/syntax_text.rs b/crates/ra_syntax/src/syntax_text.rs index e648dc082d..939f2c02f9 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> { } pub fn to_smol_string(&self) -> SmolStr { - // FIXME: use `self.chunks().collect()` here too once - // https://github.com/matklad/smol_str/pull/12 is merged and published - self.to_string().into() + self.chunks().collect() } pub fn contains(&self, c: char) -> bool { @@ -63,6 +61,10 @@ impl<'a> SyntaxText<'a> { self.range.len() } + pub fn is_empty(&self) -> bool { + self.range.is_empty() + } + /// NB, the offsets here are absolute, and this probably doesn't make sense! pub fn slice(&self, range: impl ops::RangeBounds) -> SyntaxText<'a> { let start = match range.start_bound() {