File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
external_trait_impls/rayon Expand file tree Collapse file tree 3 files changed +12
-7
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 @@ -118,11 +118,8 @@ fn special_is_empty(ctrl: u8) -> bool {
118
118
#[ inline]
119
119
#[ allow( clippy:: cast_possible_truncation) ]
120
120
fn h1 ( hash : u64 ) -> usize {
121
- #[ cfg( target_pointer_width = "32" ) ]
122
- {
123
- debug_assert ! ( hash <= u64 :: from( u32 :: max_value( ) ) ) ;
124
- }
125
- hash as usize // truncation
121
+ // On 32-bit platforms we simply ignore the higher hash bits.
122
+ hash as usize
126
123
}
127
124
128
125
/// Secondary hash function, saved in the low 7 bits of the control byte.
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