Rollup merge of #132113 - LaihoE:pattern_as_utf8_default_impl, r=workingjubilee
Provide a default impl for Pattern::as_utf8_pattern Newly added ```Pattern::as_utf8_pattern()``` causes needless breakage for crates that implement Pattern. This provides a default implementation instead. r? `@BurntSushi`
This commit is contained in:
commit
96ae9d4703
@ -162,7 +162,9 @@ fn strip_suffix_of<'a>(self, haystack: &'a str) -> Option<&'a str>
|
||||
}
|
||||
|
||||
/// Returns the pattern as utf-8 bytes if possible.
|
||||
fn as_utf8_pattern(&self) -> Option<Utf8Pattern<'_>>;
|
||||
fn as_utf8_pattern(&self) -> Option<Utf8Pattern<'_>> {
|
||||
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<C: MultiCharEq> Pattern for MultiCharEqPattern<C> {
|
||||
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<Utf8Pattern<'_>> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl<'a, C: MultiCharEq> Searcher<'a> for MultiCharEqSearcher<'a, C> {
|
||||
@ -770,11 +767,6 @@ fn strip_suffix_of<$a>(self, haystack: &$a str) -> Option<&$a str>
|
||||
{
|
||||
($pmap)(self).strip_suffix_of(haystack)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn as_utf8_pattern(&self) -> Option<Utf8Pattern<'_>> {
|
||||
None
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user