Use helper method to clarify code

This commit is contained in:
Dirkjan Ochtman 2021-02-10 16:57:08 +01:00
parent 1934478cfe
commit a99c61fee5
1 changed files with 2 additions and 2 deletions

View File

@ -234,7 +234,7 @@ where
#[cfg(feature = "indicatif")] #[cfg(feature = "indicatif")]
let done = AtomicUsize::new(0); let done = AtomicUsize::new(0);
for (layer, range) in ranges { for (layer, range) in ranges {
let num = if layer.0 > 0 { M } else { M * 2 }; let num = if layer.is_zero() { M * 2 } else { M };
#[cfg(feature = "indicatif")] #[cfg(feature = "indicatif")]
if let Some(bar) = &progress { if let Some(bar) = &progress {
bar.set_message(&format!("Building index (layer {})", layer.0)); bar.set_message(&format!("Building index (layer {})", layer.0));
@ -285,7 +285,7 @@ where
// For layers above the zero layer, make a copy of the current state of the zero layer // For layers above the zero layer, make a copy of the current state of the zero layer
// with `nearest` truncated to `M` elements. // with `nearest` truncated to `M` elements.
if layer.0 > 0 { if !layer.is_zero() {
let mut upper = Vec::new(); let mut upper = Vec::new();
(&zero) (&zero)
.into_par_iter() .into_par_iter()