Skip to content

Commit 86c6f27

Browse files
Rollup merge of rust-lang#132606 - eduardosm:char-slice-str-pattern-doc, r=tgross35
Improve example of `impl Pattern for &[char]` The previous version used `['l', 'l']` as pattern, which would suggest that it matches the `ll` of `Hello world` as a whole.
2 parents 4660d7e + 92bb779 commit 86c6f27

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/str/pattern.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,8 @@ impl<'a, 'b> DoubleEndedSearcher<'a> for CharSliceSearcher<'a, 'b> {}
886886
/// # Examples
887887
///
888888
/// ```
889-
/// assert_eq!("Hello world".find(&['l', 'l'] as &[_]), Some(2));
890-
/// assert_eq!("Hello world".find(&['l', 'l'][..]), Some(2));
889+
/// assert_eq!("Hello world".find(&['o', 'l'][..]), Some(2));
890+
/// assert_eq!("Hello world".find(&['h', 'w'][..]), Some(6));
891891
/// ```
892892
impl<'b> Pattern for &'b [char] {
893893
pattern_methods!('a, CharSliceSearcher<'a, 'b>, MultiCharEqPattern, CharSliceSearcher);

0 commit comments

Comments
 (0)