Skip to content

Commit 47232ad

Browse files
committed
Fix some misleading and copy-pasted Pattern examples
These examples were listed twice and also were confusable with doing a substring match instead of a any-of-set match.
1 parent 8e8116c commit 47232ad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/core/src/str/pattern.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,8 @@ pub struct CharArrayRefSearcher<'a, 'b, const N: usize>(
791791
/// # Examples
792792
///
793793
/// ```
794-
/// assert_eq!("Hello world".find(['l', 'l']), Some(2));
795-
/// assert_eq!("Hello world".find(['l', 'l']), Some(2));
794+
/// assert_eq!("Hello world".find(['o', 'l']), Some(2));
795+
/// assert_eq!("Hello world".find(['h', 'w']), Some(6));
796796
/// ```
797797
impl<'a, const N: usize> Pattern<'a> for [char; N] {
798798
pattern_methods!(CharArraySearcher<'a, N>, MultiCharEqPattern, CharArraySearcher);
@@ -811,8 +811,8 @@ unsafe impl<'a, const N: usize> ReverseSearcher<'a> for CharArraySearcher<'a, N>
811811
/// # Examples
812812
///
813813
/// ```
814-
/// assert_eq!("Hello world".find(&['l', 'l']), Some(2));
815-
/// assert_eq!("Hello world".find(&['l', 'l']), Some(2));
814+
/// assert_eq!("Hello world".find(&['o', 'l']), Some(2));
815+
/// assert_eq!("Hello world".find(&['h', 'w']), Some(6));
816816
/// ```
817817
impl<'a, 'b, const N: usize> Pattern<'a> for &'b [char; N] {
818818
pattern_methods!(CharArrayRefSearcher<'a, 'b, N>, MultiCharEqPattern, CharArrayRefSearcher);

0 commit comments

Comments
 (0)