aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-01-05 12:28:07 +0000
committerAleksey Kladov <[email protected]>2019-01-05 12:28:07 +0000
commit79fd6b5c881d93c427abba6d9376965837decb24 (patch)
tree9d97aea78bc359e55217e66bd77f1aaa14cda816 /crates/ra_syntax/src
parent9b5b13dfcfe32bccbf3593eee26bf88a5fd60413 (diff)
change visibility can change pub to pub(crate)
Diffstat (limited to 'crates/ra_syntax/src')
-rw-r--r--crates/ra_syntax/src/yellow/syntax_text.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/ra_syntax/src/yellow/syntax_text.rs b/crates/ra_syntax/src/yellow/syntax_text.rs
index 783dca214..279a83b61 100644
--- a/crates/ra_syntax/src/yellow/syntax_text.rs
+++ b/crates/ra_syntax/src/yellow/syntax_text.rs
@@ -125,3 +125,21 @@ impl From<SyntaxText<'_>> for String {
125 text.to_string() 125 text.to_string()
126 } 126 }
127} 127}
128
129impl PartialEq<str> for SyntaxText<'_> {
130 fn eq(&self, mut rhs: &str) -> bool {
131 for chunk in self.chunks() {
132 if !rhs.starts_with(chunk) {
133 return false;
134 }
135 rhs = &rhs[chunk.len()..];
136 }
137 rhs.is_empty()
138 }
139}
140
141impl PartialEq<&'_ str> for SyntaxText<'_> {
142 fn eq(&self, rhs: &&str) -> bool {
143 self == *rhs
144 }
145}