about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-05-15 10:58:42 +0200
committerGitHub <noreply@github.com>2023-05-15 10:58:42 +0200
commit9d8c11ba75694356771fd59ea015ec6d20c108d7 (patch)
treee07e66fbc7fbbb0e0e0d064fdfba77d4ba5623f3
parent74952de4b748af2da5462005b58254c65628323f (diff)
parent47232ade6151a8e7d2112e2dda0c7c5c930b0a31 (diff)
downloadrust-9d8c11ba75694356771fd59ea015ec6d20c108d7.tar.gz
rust-9d8c11ba75694356771fd59ea015ec6d20c108d7.zip
Rollup merge of #111581 - scottmcm:fix-pattern-comment, r=workingjubilee
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.
-rw-r--r--library/core/src/str/pattern.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/library/core/src/str/pattern.rs b/library/core/src/str/pattern.rs
index e3a464a1c51..91ee2903aab 100644
--- a/library/core/src/str/pattern.rs
+++ b/library/core/src/str/pattern.rs
@@ -791,8 +791,8 @@ pub struct CharArrayRefSearcher<'a, 'b, const N: usize>(
 /// # Examples
 ///
 /// ```
-/// assert_eq!("Hello world".find(['l', 'l']), Some(2));
-/// assert_eq!("Hello world".find(['l', 'l']), Some(2));
+/// assert_eq!("Hello world".find(['o', 'l']), Some(2));
+/// assert_eq!("Hello world".find(['h', 'w']), Some(6));
 /// ```
 impl<'a, const N: usize> Pattern<'a> for [char; N] {
     pattern_methods!(CharArraySearcher<'a, N>, MultiCharEqPattern, CharArraySearcher);
@@ -811,8 +811,8 @@ unsafe impl<'a, const N: usize> ReverseSearcher<'a> for CharArraySearcher<'a, N>
 /// # Examples
 ///
 /// ```
-/// assert_eq!("Hello world".find(&['l', 'l']), Some(2));
-/// assert_eq!("Hello world".find(&['l', 'l']), Some(2));
+/// assert_eq!("Hello world".find(&['o', 'l']), Some(2));
+/// assert_eq!("Hello world".find(&['h', 'w']), Some(6));
 /// ```
 impl<'a, 'b, const N: usize> Pattern<'a> for &'b [char; N] {
     pattern_methods!(CharArrayRefSearcher<'a, 'b, N>, MultiCharEqPattern, CharArrayRefSearcher);