aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/yellow
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-01-05 12:28:42 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-01-05 12:28:42 +0000
commit0f0969b64adffb99f1b284d268e653ea264c5afb (patch)
treed1737d80257dab493a3de02e324c3a5e421dd591 /crates/ra_syntax/src/yellow
parent44e42edc8b7729716e0b410ced2e96c33573e2c0 (diff)
parent79fd6b5c881d93c427abba6d9376965837decb24 (diff)
Merge #434
434: change visibility can change pub to pub(crate) r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/yellow')
-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}