@@ -74,7 +74,7 @@ pub(crate) fn min_max_generic_parallel<T: Copy + PartialOrd + Send + Sync>(
7474 . num_threads ( n_threads)
7575 . build ( ) ;
7676
77- let mut zip_func = || {
77+ let zip_func = || {
7878 Zip :: from ( sampled_indices. exact_chunks_mut ( 2 ) ) . par_for_each ( |mut sampled_index| {
7979 let i: f64 = unsafe { * sampled_index. uget ( 0 ) >> 1 } as f64 ;
8080 let start_idx: usize = ( block_size * i) as usize + ( i != 0.0 ) as usize ;
@@ -95,13 +95,7 @@ pub(crate) fn min_max_generic_parallel<T: Copy + PartialOrd + Send + Sync>(
9595 } ) ;
9696 } ;
9797
98- if let Ok ( pool) = pool {
99- pool. install ( zip_func) ;
100- } else {
101- // if a pool, for some reason, could not be created, we fall back to default Rayon
102- // behaviour. (Question: Should this be the behaviour in this case?)
103- zip_func ( ) ;
104- }
98+ pool. unwrap ( ) . install ( zip_func) ; // allow panic if pool could not be created
10599
106100 sampled_indices
107101}
@@ -170,7 +164,7 @@ pub(crate) fn min_max_generic_with_x_parallel<T: Copy + Send + Sync>(
170164 . num_threads ( n_threads)
171165 . build ( ) ;
172166
173- let iterator_func = || {
167+ let iter_func = || {
174168 Array1 :: from_vec (
175169 bin_idx_iterator
176170 . flat_map ( |bin_idx_iterator| {
@@ -211,11 +205,5 @@ pub(crate) fn min_max_generic_with_x_parallel<T: Copy + Send + Sync>(
211205 )
212206 } ;
213207
214- if let Ok ( pool) = pool {
215- pool. install ( iterator_func)
216- } else {
217- // if a pool, for some reason, could not be created, we fall back to default Rayon
218- // behaviour. (Question: Should this be the behaviour in this case?)
219- iterator_func ( )
220- }
208+ pool. unwrap ( ) . install ( iter_func) // allow panic if pool could not be created
221209}
0 commit comments