aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax
diff options
context:
space:
mode:
authorPascal Hertleif <[email protected]>2019-05-25 11:56:52 +0100
committerPascal Hertleif <[email protected]>2019-05-27 10:26:35 +0100
commited89b0638b1dbf8f9a33d9a95e829e602142bb05 (patch)
treeb0b6b5f33fb25d79744662e1c17b6c610de67b95 /crates/ra_syntax
parent5bf3e949e8470a138a61c806769e1a329761cab6 (diff)
Hash based on binding name and shadow counter
Diffstat (limited to 'crates/ra_syntax')
-rw-r--r--crates/ra_syntax/src/syntax_text.rs7
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 @@
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,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 }