From 689101f8a3ea26f70902b10ab99b9860f565d9dc Mon Sep 17 00:00:00 2001 From: Laiho Date: Thu, 24 Oct 2024 19:08:41 +0300 Subject: [PATCH] provide default impl for as_utf8_pattern --- library/core/src/str/pattern.rs | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/library/core/src/str/pattern.rs b/library/core/src/str/pattern.rs index eb60effe8138f..f68465c9bdac6 100644 --- a/library/core/src/str/pattern.rs +++ b/library/core/src/str/pattern.rs @@ -162,7 +162,9 @@ pub trait Pattern: Sized { } /// Returns the pattern as utf-8 bytes if possible. - fn as_utf8_pattern(&self) -> Option>; + fn as_utf8_pattern(&self) -> Option> { + None + } } /// Result of calling [`Pattern::as_utf8_pattern()`]. /// Can be used for inspecting the contents of a [`Pattern`] in cases @@ -675,11 +677,6 @@ impl Pattern for MultiCharEqPattern { fn into_searcher(self, haystack: &str) -> MultiCharEqSearcher<'_, C> { MultiCharEqSearcher { haystack, char_eq: self.0, char_indices: haystack.char_indices() } } - - #[inline] - fn as_utf8_pattern(&self) -> Option> { - None - } } unsafe impl<'a, C: MultiCharEq> Searcher<'a> for MultiCharEqSearcher<'a, C> { @@ -770,11 +767,6 @@ macro_rules! pattern_methods { { ($pmap)(self).strip_suffix_of(haystack) } - - #[inline] - fn as_utf8_pattern(&self) -> Option> { - None - } }; }