File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -1157,14 +1157,13 @@ impl str {
1157
1157
///
1158
1158
/// Returns `false` if it does not.
1159
1159
///
1160
- /// The [pattern] can be a `&str`, [`char`], a slice of [`char`]s, or a
1161
- /// function or closure that determines if a character matches .
1160
+ /// The [pattern] can be a `&str`, in which case this function will return true if
1161
+ /// the `&str` is a prefix of this string slice .
1162
1162
///
1163
- /// Note that there is a footgun to this method when using a slice of [`char`]s.
1164
- /// Some users may expect that a slice of chars will behave similarly to a `&str` with this method.
1165
- /// That is not currently the case. When you pass a slice of [`char`]s to this method, it will return true
1166
- /// if any of the [`char`]s in the slice is the first [`char`] of this string slice. It does not work for
1167
- /// sequentially comparing a slice of [`char`]s to a string slice. See the second example below.
1163
+ /// The [pattern] can also be a [`char`], a slice of [`char`]s, or a
1164
+ /// function or closure that determines if a character matches.
1165
+ /// These will only be checked against the first character of this string slice.
1166
+ /// Look at the second example below regarding behavior for slices of [`char`]s.
1168
1167
///
1169
1168
/// [`char`]: prim@char
1170
1169
/// [pattern]: self::pattern
You can’t perform that action at this time.
0 commit comments