diff options
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r-- | crates/ra_syntax/src/syntax_text.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/syntax_text.rs b/crates/ra_syntax/src/syntax_text.rs index b013164c4..bff1ed5a0 100644 --- a/crates/ra_syntax/src/syntax_text.rs +++ b/crates/ra_syntax/src/syntax_text.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use std::{fmt, ops::{self, Bound}}; | 1 | use std::{fmt, ops::{self, Bound}}; |
2 | 2 | ||
3 | use crate::{SyntaxNode, TextRange, TextUnit, SyntaxElement}; | 3 | use crate::{SmolStr, SyntaxNode, TextRange, TextUnit, SyntaxElement}; |
4 | 4 | ||
5 | #[derive(Clone)] | 5 | #[derive(Clone)] |
6 | pub struct SyntaxText<'a> { | 6 | pub struct SyntaxText<'a> { |
@@ -34,6 +34,11 @@ 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 | // TODO: `impl iter::FromIterator<&str> for SmolStr` | ||
39 | self.to_string().into() | ||
40 | } | ||
41 | |||
37 | pub fn contains(&self, c: char) -> bool { | 42 | pub fn contains(&self, c: char) -> bool { |
38 | self.chunks().any(|it| it.contains(c)) | 43 | self.chunks().any(|it| it.contains(c)) |
39 | } | 44 | } |