diff options
| author | Venus Xeon-Blonde <alfriadox@gmail.com> | 2024-02-09 22:24:57 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-09 22:24:57 -0500 |
| commit | d7263d7aada418eb22d0560388379a2e3658e211 (patch) | |
| tree | dfde134c3a4bea9d8bb1a4155e319edf748a5393 | |
| parent | 8ff1994ec06a0bc4d8f80ecbefe981013b902a9b (diff) | |
Change wording
| -rw-r--r-- | library/core/src/str/mod.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 597d924469c..e11d13f8bed 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -1157,14 +1157,13 @@ impl str { /// /// Returns `false` if it does not. /// - /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a - /// function or closure that determines if a character matches. + /// The [pattern] can be a `&str`, in which case this function will return true if + /// the `&str` is a prefix of this string slice. /// - /// Note that there is a footgun to this method when using a slice of [`char`]s. - /// Some users may expect that a slice of chars will behave similarly to a `&str` with this method. - /// That is not currently the case. When you pass a slice of [`char`]s to this method, it will return true - /// if any of the [`char`]s in the slice is the first [`char`] of this string slice. It does not work for - /// sequentially comparing a slice of [`char`]s to a string slice. See the second example below. + /// The [pattern] can also be a [`char`], a slice of [`char`]s, or a + /// function or closure that determines if a character matches. + /// These will only be checked against the first character of this string slice. + /// Look at the second example below regarding behavior for slices of [`char`]s. /// /// [`char`]: prim@char /// [pattern]: self::pattern |
