Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4620004

Browse files
authoredNov 5, 2024
Unrolled build for rust-lang#132606
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 96477c5 + 4872b6b commit 4620004

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎library/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)
Failed to load comments.