Skip to content

Commit d53469c

Browse files
committed
Clarify documentation for [T]::contains. Fixes #84877.
1 parent 716394d commit d53469c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

library/core/src/slice/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1948,8 +1948,9 @@ impl<T> [T] {
19481948
/// assert!(!v.contains(&50));
19491949
/// ```
19501950
///
1951-
/// If you do not have an `&T`, but just an `&U` such that `T: Borrow<U>`
1952-
/// (e.g. `String: Borrow<str>`), you can use `iter().any`:
1951+
/// If you do not have a `&T`, but some other value that you can compare
1952+
/// with one (for example, `String` implements `PartialEq<str>`), you can
1953+
/// use `iter().any`:
19531954
///
19541955
/// ```
19551956
/// let v = [String::from("hello"), String::from("world")]; // slice of `String`

0 commit comments

Comments
 (0)