about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2024-11-04 20:40:49 -0800
committerGitHub <noreply@github.com>2024-11-04 20:40:49 -0800
commit67477ca342f0c79ea8f585b1c1e9155e29d009b7 (patch)
tree7800bda0ca74591984643861bfc9e10897ee8f02
parent3d4dd742bbaf93f69296b1afbfd35a3c5e3d92c5 (diff)
parent4872b6bcbd8f2800b370b7e05b1ca1e18054a166 (diff)
downloadrust-67477ca342f0c79ea8f585b1c1e9155e29d009b7.tar.gz
rust-67477ca342f0c79ea8f585b1c1e9155e29d009b7.zip
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.
-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);