Rollup merge of #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.
This commit is contained in:
commit
67477ca342
@ -886,8 +886,8 @@ impl<'a, 'b> DoubleEndedSearcher<'a> for CharSliceSearcher<'a, 'b> {}
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// assert_eq!("Hello world".find(&['l', 'l'] as &[_]), Some(2));
|
/// assert_eq!("Hello world".find(&['o', 'l'][..]), Some(2));
|
||||||
/// assert_eq!("Hello world".find(&['l', 'l'][..]), Some(2));
|
/// assert_eq!("Hello world".find(&['h', 'w'][..]), Some(6));
|
||||||
/// ```
|
/// ```
|
||||||
impl<'b> Pattern for &'b [char] {
|
impl<'b> Pattern for &'b [char] {
|
||||||
pattern_methods!('a, CharSliceSearcher<'a, 'b>, MultiCharEqPattern, CharSliceSearcher);
|
pattern_methods!('a, CharSliceSearcher<'a, 'b>, MultiCharEqPattern, CharSliceSearcher);
|
||||||
|
Loading…
Reference in New Issue
Block a user