Skip to content

Commit

Permalink
Make behavior of maybe_sub consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
alice-i-cecile committed Jun 11, 2022
1 parent 4e54472 commit 1d48d1d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl MaybeMath<Option<f32>, Option<f32>> for Option<f32> {
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,
}
}
Expand Down Expand Up @@ -86,7 +86,7 @@ impl MaybeMath<f32, Option<f32>> for Option<f32> {
fn maybe_sub(self, rhs: f32) -> Option<f32> {
match self {
Some(val) => Some(val - rhs),
None => None,
None => -rhs,
}
}
}
Expand Down

0 comments on commit 1d48d1d

Please sign in to comment.