provide default impl for as_utf8_pattern · qinheping/verify-rust-std@115a851 (original) (raw)

`@@ -162,7 +162,9 @@ pub trait Pattern: Sized {

`

162

162

`}

`

163

163

``

164

164

`/// 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

`+

}

`

166

168

`}

`

167

169

`` /// Result of calling [Pattern::as_utf8_pattern()].

``

168

170

`` /// Can be used for inspecting the contents of a [Pattern] in cases

``

`@@ -675,11 +677,6 @@ impl<C: MultiCharEq> Pattern for MultiCharEqPattern {

`

675

677

`fn into_searcher(self, haystack: &str) -> MultiCharEqSearcher<'_, C> {

`

676

678

`MultiCharEqSearcher { haystack, char_eq: self.0, char_indices: haystack.char_indices() }

`

677

679

`}

`

678

``

-

679

``

`-

#[inline]

`

680

``

`-

fn as_utf8_pattern(&self) -> Option<Utf8Pattern<'_>> {

`

681

``

`-

None

`

682

``

`-

}

`

683

680

`}

`

684

681

``

685

682

`unsafe impl<'a, C: MultiCharEq> Searcher<'a> for MultiCharEqSearcher<'a, C> {

`

`@@ -770,11 +767,6 @@ macro_rules! pattern_methods {

`

770

767

`{

`

771

768

`($pmap)(self).strip_suffix_of(haystack)

`

772

769

`}

`

773

``

-

774

``

`-

#[inline]

`

775

``

`-

fn as_utf8_pattern(&self) -> Option<Utf8Pattern<'_>> {

`

776

``

`-

None

`

777

``

`-

}

`

778

770

`};

`

779

771

`}

`

780

772

``