Skip to content

Commit 92bb779

Browse files
committed
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.
1 parent 84fae7e commit 92bb779

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)