File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ pub(crate) use cast::*;
2121pub ( crate ) use compare:: * ;
2222pub ( crate ) use fill_null:: * ;
2323pub ( crate ) use filter:: * ;
24+ use itertools:: Itertools ;
2425use libfuzzer_sys:: arbitrary:: Error :: EmptyChoose ;
2526use libfuzzer_sys:: arbitrary:: { Arbitrary , Unstructured } ;
2627pub ( crate ) use mask:: * ;
@@ -331,14 +332,14 @@ impl<'a> Arbitrary<'a> for FuzzArrayAction {
331332 }
332333
333334 let num_indices = u. int_in_range ( 1 ..=5 . min ( current_array. len ( ) ) ) ?;
334- let mut indices = HashSet :: with_capacity ( num_indices) ;
335-
336- while indices . len ( ) < num_indices {
337- let idx = u . choose_index ( current_array . len ( ) ) ? ;
338- indices . insert ( idx ) ;
339- }
340-
341- let indices_vec : Vec < usize > = indices . into_iter ( ) . collect ( ) ;
335+ let indices_vec = ( 0 .. num_indices)
336+ . map ( |_| {
337+ u . choose_index ( current_array . len ( ) )
338+ . ok ( )
339+ . vortex_expect ( "cannot pick" )
340+ } )
341+ . unique ( )
342+ . collect :: < Vec < _ > > ( ) ;
342343
343344 // Compute expected scalars using the baseline implementation
344345 let expected_scalars: Vec < Scalar > = indices_vec
You can’t perform that action at this time.
0 commit comments