Skip to content

Commit 50d171c

Browse files
authored
Rollup merge of rust-lang#97700 - nzrq:patch-1, r=dtolnay
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.
2 parents ffd930c + f4e6536 commit 50d171c

File tree

1 file changed

+6
-0
lines changed
  • std/src/collections/hash

1 file changed

+6
-0
lines changed

std/src/collections/hash/set.rs

+6
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,12 @@ where
588588
/// Visits the values representing the intersection,
589589
/// i.e., the values that are both in `self` and `other`.
590590
///
591+
/// When an equal element is present in `self` and `other`
592+
/// then the resulting `Intersection` may yield references to
593+
/// one or the other. This can be relevant if `T` contains fields which
594+
/// are not compared by its `Eq` implementation, and may hold different
595+
/// value between the two equal copies of `T` in the two sets.
596+
///
591597
/// # Examples
592598
///
593599
/// ```

0 commit comments

Comments
 (0)