File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
external_trait_impls/rayon Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -256,7 +256,11 @@ where
256
256
///
257
257
/// This method runs in a potentially parallel fashion.
258
258
pub fn par_is_subset ( & self , other : & Self ) -> bool {
259
- self . into_par_iter ( ) . all ( |x| other. contains ( x) )
259
+ if self . len ( ) <= other. len ( ) {
260
+ self . into_par_iter ( ) . all ( |x| other. contains ( x) )
261
+ } else {
262
+ false
263
+ }
260
264
}
261
265
262
266
/// Returns `true` if the set is a superset of another,
Original file line number Diff line number Diff line change @@ -640,7 +640,11 @@ where
640
640
/// assert_eq!(set.is_subset(&sup), false);
641
641
/// ```
642
642
pub fn is_subset ( & self , other : & Self ) -> bool {
643
- self . iter ( ) . all ( |v| other. contains ( v) )
643
+ if self . len ( ) <= other. len ( ) {
644
+ self . iter ( ) . all ( |v| other. contains ( v) )
645
+ } else {
646
+ false
647
+ }
644
648
}
645
649
646
650
/// Returns `true` if the set is a superset of another,
You can’t perform that action at this time.
0 commit comments