diff --git a/src/math.rs b/src/math.rs index 687192bba..cd9ad6512 100644 --- a/src/math.rs +++ b/src/math.rs @@ -57,38 +57,20 @@ impl MaybeMath, Option> for Option { } impl MaybeMath> for Option { - // The logic here is subtle and critical; - // explicit match statements make it more clear what's going on - #[allow(clippy::manual_map)] fn maybe_min(self, rhs: f32) -> Option { - match self { - Some(val) => Some(val.min(rhs)), - None => None, - } + self.map(|val| val.min(rhs)) } - #[allow(clippy::manual_map)] fn maybe_max(self, rhs: f32) -> Option { - match self { - Some(val) => Some(val.max(rhs)), - None => None, - } + self.map(|val| val.max(rhs)) } - #[allow(clippy::manual_map)] fn maybe_add(self, rhs: f32) -> Option { - match self { - Some(val) => Some(val + rhs), - None => None, - } + self.map(|val| val + rhs) } - #[allow(clippy::manual_map)] fn maybe_sub(self, rhs: f32) -> Option { - match self { - Some(val) => Some(val - rhs), - None => None, - } + self.map(|val| val - rhs) } }