Auto merge of #42105 - Mark-Simulacrum:rollup, r=Mark-Simulacrum

Rollup of 17 pull requests

- Successful merges: #41870, #41910, #41958, #41971, #42006, #42024, #42037, #42056, #42067, #42070, #42079, #42080, #42082, #42089, #42092, #42096, #42100
- Failed merges:
This commit is contained in:
bors
2017-05-19 20:41:18 +00:00
71 changed files with 957 additions and 523 deletions

View File

@@ -429,7 +429,33 @@ impl<'a> DoubleEndedSearcher<'a> for CharSearcher<'a> {}
/// Searches for chars that are equal to a given char
impl<'a> Pattern<'a> for char {
pattern_methods!(CharSearcher<'a>, CharEqPattern, CharSearcher);
type Searcher = CharSearcher<'a>;
#[inline]
fn into_searcher(self, haystack: &'a str) -> Self::Searcher {
CharSearcher(CharEqPattern(self).into_searcher(haystack))
}
#[inline]
fn is_contained_in(self, haystack: &'a str) -> bool {
if (self as u32) < 128 {
haystack.as_bytes().contains(&(self as u8))
} else {
let mut buffer = [0u8; 4];
self.encode_utf8(&mut buffer).is_contained_in(haystack)
}
}
#[inline]
fn is_prefix_of(self, haystack: &'a str) -> bool {
CharEqPattern(self).is_prefix_of(haystack)
}
#[inline]
fn is_suffix_of(self, haystack: &'a str) -> bool where Self::Searcher: ReverseSearcher<'a>
{
CharEqPattern(self).is_suffix_of(haystack)
}
}
/////////////////////////////////////////////////////////////////////////////