mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-04 18:40:57 +03:00
Minor cleanup in Pattern::{is_prefix_of,is_suffix_of} for char
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user