File tree 3 files changed +14
-6
lines changed
external_trait_impls/rayon 3 files changed +14
-6
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 @@ -145,7 +145,7 @@ fn h2(hash: u64) -> u8 {
145
145
/// (skipping over 1 group), then 3 groups (skipping over 2 groups), and so on.
146
146
///
147
147
/// Proof that the probe will visit every group in the table:
148
- /// https://fgiesen.wordpress.com/2015/02/22/triangular-numbers-mod-2n/
148
+ /// < https://fgiesen.wordpress.com/2015/02/22/triangular-numbers-mod-2n/>
149
149
struct ProbeSeq {
150
150
bucket_mask : usize ,
151
151
pos : usize ,
@@ -935,12 +935,12 @@ impl<T> RawTable<T> {
935
935
/// should be dropped using a `RawIter` before freeing the allocation.
936
936
#[ inline]
937
937
pub fn into_alloc ( self ) -> Option < ( NonNull < u8 > , Layout ) > {
938
- let alloc = if !self . is_empty_singleton ( ) {
938
+ let alloc = if self . is_empty_singleton ( ) {
939
+ None
940
+ } else {
939
941
let ( layout, _) = calculate_layout :: < T > ( self . buckets ( ) )
940
942
. unwrap_or_else ( || unsafe { hint:: unreachable_unchecked ( ) } ) ;
941
943
Some ( ( self . ctrl . cast ( ) , layout) )
942
- } else {
943
- None
944
944
} ;
945
945
mem:: forget ( self ) ;
946
946
alloc
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