aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/syntax_text.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/syntax_text.rs b/crates/ra_syntax/src/syntax_text.rs
index b013164c4..c9038cd5c 100644
--- a/crates/ra_syntax/src/syntax_text.rs
+++ b/crates/ra_syntax/src/syntax_text.rs
@@ -1,6 +1,6 @@
1use std::{fmt, ops::{self, Bound}}; 1use std::{fmt, ops::{self, Bound}};
2 2
3use crate::{SyntaxNode, TextRange, TextUnit, SyntaxElement}; 3use crate::{SmolStr, SyntaxNode, TextRange, TextUnit, SyntaxElement};
4 4
5#[derive(Clone)] 5#[derive(Clone)]
6pub struct SyntaxText<'a> { 6pub struct SyntaxText<'a> {
@@ -34,6 +34,12 @@ impl<'a> SyntaxText<'a> {
34 self.chunks().collect() 34 self.chunks().collect()
35 } 35 }
36 36
37 pub fn to_smol_string(&self) -> SmolStr {
38 // FIXME: use `self.chunks().collect()` here too once
39 // https://github.com/matklad/smol_str/pull/12 is merged and published
40 self.to_string().into()
41 }
42
37 pub fn contains(&self, c: char) -> bool { 43 pub fn contains(&self, c: char) -> bool {
38 self.chunks().any(|it| it.contains(c)) 44 self.chunks().any(|it| it.contains(c))
39 } 45 }