Skip to content

Commit fc448cf

Browse files
committed
Optimize Set is_disjoint
1 parent 2310a95 commit fc448cf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@ where
10441044
/// assert_eq!(a.is_disjoint(&b), false);
10451045
/// ```
10461046
pub fn is_disjoint(&self, other: &Self) -> bool {
1047-
self.iter().all(|v| !other.contains(v))
1047+
self.intersection(other).next().is_none()
10481048
}
10491049

10501050
/// Returns `true` if the set is a subset of another,

0 commit comments

Comments
 (0)