about summary refs log tree commit diff
path: root/library/core/src/str/pattern.rs
diff options
context:
space:
mode:
authorEduardo Sánchez Muñoz <eduardosm-dev@e64.io>2024-11-04 19:08:28 +0100
committerEduardo Sánchez Muñoz <eduardosm-dev@e64.io>2024-11-04 19:08:28 +0100
commit4872b6bcbd8f2800b370b7e05b1ca1e18054a166 (patch)
treec2442693f4b221735970e4ead6fd5a56328a50b6 /library/core/src/str/pattern.rs
parent432972cae64d736b892e7a4c8b4fe7fe0e888904 (diff)
downloadrust-4872b6bcbd8f2800b370b7e05b1ca1e18054a166.tar.gz
rust-4872b6bcbd8f2800b370b7e05b1ca1e18054a166.zip
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.
Diffstat (limited to 'library/core/src/str/pattern.rs')
-rw-r--r--library/core/src/str/pattern.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/core/src/str/pattern.rs b/library/core/src/str/pattern.rs
index 665c9fc67d0..52e2364893e 100644
--- a/library/core/src/str/pattern.rs
+++ b/library/core/src/str/pattern.rs
@@ -886,8 +886,8 @@ impl<'a, 'b> DoubleEndedSearcher<'a> for CharSliceSearcher<'a, 'b> {}
 /// # Examples
 ///
 /// ```
-/// assert_eq!("Hello world".find(&['l', 'l'] as &[_]), 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<'b> Pattern for &'b [char] {
     pattern_methods!('a, CharSliceSearcher<'a, 'b>, MultiCharEqPattern, CharSliceSearcher);