Skip to content

Commit

Permalink
Rollup merge of #97700 - nzrq:patch-1, r=dtolnay
Browse files Browse the repository at this point in the history
Add note to documentation of HashSet::intersection

The functionality of the `std::collections::HashSet::intersection(...)` method was slightly surprising to me so I wanted to take a sec to contribute to the documentation for this method.

I've added a `Note:` section if that is appropriate.
  • Loading branch information
matthiaskrgr authored Jun 6, 2022
2 parents 50b0025 + 7d114c7 commit c4bfd10
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/std/src/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,12 @@ where
/// Visits the values representing the intersection,
/// i.e., the values that are both in `self` and `other`.
///
/// When an equal element is present in `self` and `other`
/// then the resulting `Intersection` may yield references to
/// one or the other. This can be relevant if `T` contains fields which
/// are not compared by its `Eq` implementation, and may hold different
/// value between the two equal copies of `T` in the two sets.
///
/// # Examples
///
/// ```
Expand Down

0 comments on commit c4bfd10

Please sign in to comment.