Skip to content

Commit 689101f

Browse files
committed
provide default impl for as_utf8_pattern
1 parent b27f33a commit 689101f

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

library/core/src/str/pattern.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ pub trait Pattern: Sized {
162162
}
163163

164164
/// Returns the pattern as utf-8 bytes if possible.
165-
fn as_utf8_pattern(&self) -> Option<Utf8Pattern<'_>>;
165+
fn as_utf8_pattern(&self) -> Option<Utf8Pattern<'_>> {
166+
None
167+
}
166168
}
167169
/// Result of calling [`Pattern::as_utf8_pattern()`].
168170
/// Can be used for inspecting the contents of a [`Pattern`] in cases
@@ -675,11 +677,6 @@ impl<C: MultiCharEq> Pattern for MultiCharEqPattern<C> {
675677
fn into_searcher(self, haystack: &str) -> MultiCharEqSearcher<'_, C> {
676678
MultiCharEqSearcher { haystack, char_eq: self.0, char_indices: haystack.char_indices() }
677679
}
678-
679-
#[inline]
680-
fn as_utf8_pattern(&self) -> Option<Utf8Pattern<'_>> {
681-
None
682-
}
683680
}
684681

685682
unsafe impl<'a, C: MultiCharEq> Searcher<'a> for MultiCharEqSearcher<'a, C> {
@@ -770,11 +767,6 @@ macro_rules! pattern_methods {
770767
{
771768
($pmap)(self).strip_suffix_of(haystack)
772769
}
773-
774-
#[inline]
775-
fn as_utf8_pattern(&self) -> Option<Utf8Pattern<'_>> {
776-
None
777-
}
778770
};
779771
}
780772

0 commit comments

Comments
 (0)