diff --git a/tests/by-util/test_factor.rs b/tests/by-util/test_factor.rs index 542c6fb3f7e..a14a673a8d3 100644 --- a/tests/by-util/test_factor.rs +++ b/tests/by-util/test_factor.rs @@ -163,14 +163,12 @@ fn test_random() { let mut factors = Vec::new(); while product < min { // log distribution---higher probability for lower numbers - let factor; - loop { + let factor = loop { let next = rng.gen_range(0_f64..log_num_primes).exp2().floor() as usize; if next < NUM_PRIMES { - factor = primes[next]; - break; + break primes[next]; } - } + }; match product.checked_mul(factor) { Some(p) => {