From 114fda05192d52ab177bb25fee389d1b32bae08e Mon Sep 17 00:00:00 2001 From: Roy Ivy III Date: Thu, 8 Oct 2020 23:00:33 -0500 Subject: [PATCH] tests ~ (sub-crate factor) refactor divisor() test for improved readability --- src/uu/factor/src/numeric/gcd.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/uu/factor/src/numeric/gcd.rs b/src/uu/factor/src/numeric/gcd.rs index 01e4a23bd..96a0366a2 100644 --- a/src/uu/factor/src/numeric/gcd.rs +++ b/src/uu/factor/src/numeric/gcd.rs @@ -79,7 +79,11 @@ mod tests { fn divisor(a: u64, b: u64) -> bool { // Test that gcd(a, b) divides a and b let g = gcd(a, b); - (g != 0 && a % g == 0 && b % g == 0) || (g == 0 && a == 0 && b == 0) + if g != 0 { + a % g == 0 && b % g == 0 + } else { + a == 0 && b == 0 // for g == 0 + } } fn commutative(a: u64, b: u64) -> bool {