Skip to content

Commit de7fefa

Browse files
committed
Minor cleanup in Pattern::{is_prefix_of,is_suffix_of} for char
1 parent 1f6d023 commit de7fefa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/libcore/str/pattern.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -450,15 +450,13 @@ impl<'a> Pattern<'a> for char {
450450

451451
#[inline]
452452
fn is_prefix_of(self, haystack: &'a str) -> bool {
453-
let mut buffer = [0u8; 4];
454-
self.encode_utf8(&mut buffer).is_prefix_of(haystack)
453+
self.encode_utf8(&mut [0u8; 4]).is_prefix_of(haystack)
455454
}
456455

457456
#[inline]
458457
fn is_suffix_of(self, haystack: &'a str) -> bool where Self::Searcher: ReverseSearcher<'a>
459458
{
460-
let mut buffer = [0u8; 4];
461-
self.encode_utf8(&mut buffer).is_suffix_of(haystack)
459+
self.encode_utf8(&mut [0u8; 4]).is_suffix_of(haystack)
462460
}
463461
}
464462

0 commit comments

Comments
 (0)