diff options
| author | Andrea Canciani <ranma42@gmail.com> | 2019-12-12 21:09:17 +0100 |
|---|---|---|
| committer | Andrea Canciani <ranma42@gmail.com> | 2019-12-12 21:09:17 +0100 |
| commit | de7fefa04c74ecaa7618c910a74ae1cf62affa8e (patch) | |
| tree | f8c9b799d57601710ffd4a7577737c1acb03469d /src/libcore/str/pattern.rs | |
| parent | 1f6d0234db58459c09c233efba762ad8f40adf57 (diff) | |
| download | rust-de7fefa04c74ecaa7618c910a74ae1cf62affa8e.tar.gz rust-de7fefa04c74ecaa7618c910a74ae1cf62affa8e.zip | |
Minor cleanup in `Pattern::{is_prefix_of,is_suffix_of}` for `char`
Diffstat (limited to 'src/libcore/str/pattern.rs')
| -rw-r--r-- | src/libcore/str/pattern.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index 71dd77fee73..1b6e6f1c2e4 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -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) } } |
