Minor cleanup in `Pattern::{is_prefix_of,is_suffix_of}` for `char`

This commit is contained in:
Andrea Canciani 2019-12-12 21:09:17 +01:00
parent 1f6d0234db
commit de7fefa04c
1 changed files with 2 additions and 4 deletions

View File

@ -450,15 +450,13 @@ impl<'a> Pattern<'a> for char {
#[inline]
fn is_prefix_of(self, haystack: &'a str) -> bool {
let mut buffer = [0u8; 4];
self.encode_utf8(&mut buffer).is_prefix_of(haystack)
self.encode_utf8(&mut [0u8; 4]).is_prefix_of(haystack)
}
#[inline]
fn is_suffix_of(self, haystack: &'a str) -> bool where Self::Searcher: ReverseSearcher<'a>
{
let mut buffer = [0u8; 4];
self.encode_utf8(&mut buffer).is_suffix_of(haystack)
self.encode_utf8(&mut [0u8; 4]).is_suffix_of(haystack)
}
}