From 1d48d1d29af186a827c59bbc6968bb69c4370e8f Mon Sep 17 00:00:00 2001 From: Alice Cecile Date: Fri, 10 Jun 2022 20:12:09 -0400 Subject: [PATCH] Make behavior of maybe_sub consistent --- src/math.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/math.rs b/src/math.rs index eb38dadd7..e75a1d8d0 100644 --- a/src/math.rs +++ b/src/math.rs @@ -55,7 +55,7 @@ impl MaybeMath, Option> for Option { match (self, rhs) { (Some(l), Some(r)) => Some(l - r), (Some(_l), None) => self, - (None, Some(_r)) => rhs, + (None, Some(_r)) => -rhs, (None, None) => None, } } @@ -86,7 +86,7 @@ impl MaybeMath> for Option { fn maybe_sub(self, rhs: f32) -> Option { match self { Some(val) => Some(val - rhs), - None => None, + None => -rhs, } } }