Skip to content

Commit

Permalink
Fix the comparison of union set sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Jan 18, 2021
1 parent 496b1bc commit 2c66e28
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,9 @@ where
/// ```
#[cfg_attr(feature = "inline-more", inline)]
pub fn union<'a>(&'a self, other: &'a Self) -> Union<'a, T, S, A> {
let (smaller, larger) = if self.len() >= other.len() {
// We'll iterate one set in full, and only the remaining difference from the other.
// Use the smaller set for the difference in order to reduce hash lookups.
let (smaller, larger) = if self.len() <= other.len() {
(self, other)
} else {
(other, self)
Expand Down

0 comments on commit 2c66e28

Please sign in to comment.