From 869dca85c0d4c2018b091389267cfec299a50565 Mon Sep 17 00:00:00 2001 From: gbrochar Date: Sun, 19 Nov 2023 12:55:18 +0100 Subject: [PATCH] refacto(maths::solver): remove useless branch --- src/maths.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/maths.rs b/src/maths.rs index e49bb57..38af779 100644 --- a/src/maths.rs +++ b/src/maths.rs @@ -29,9 +29,7 @@ impl Rational { pub fn reduce(&self) -> Self { let gcd = gcd(self.numerator, self.denominator); let mut res = Rational::new(self.numerator / gcd, self.denominator / gcd); - if res.numerator < 0 && res.denominator < 0 { - res = -1 * res; - } else if res.denominator < 0 { + if res.denominator < 0 { res = Rational::new(-res.numerator, -res.denominator); } res