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
+2 -4
View File
@@ -450,15 +450,13 @@ fn is_contained_in(self, haystack: &'a str) -> bool {
#[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)
}
}