From 79fd6b5c881d93c427abba6d9376965837decb24 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 5 Jan 2019 15:28:07 +0300 Subject: change visibility can change pub to pub(crate) --- crates/ra_syntax/src/yellow/syntax_text.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'crates/ra_syntax/src/yellow') 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> for String { text.to_string() } } + +impl PartialEq for SyntaxText<'_> { + fn eq(&self, mut rhs: &str) -> bool { + for chunk in self.chunks() { + if !rhs.starts_with(chunk) { + return false; + } + rhs = &rhs[chunk.len()..]; + } + rhs.is_empty() + } +} + +impl PartialEq<&'_ str> for SyntaxText<'_> { + fn eq(&self, rhs: &&str) -> bool { + self == *rhs + } +} -- cgit v1.2.3