diff --git a/src/uint.rs b/src/uint.rs index 47cee3f..4d355d7 100644 --- a/src/uint.rs +++ b/src/uint.rs @@ -815,13 +815,13 @@ macro_rules! construct_uint { } } - /// Checked addition. Returns `None` if overflow occurred. - pub fn checked_add(self, other: $name) -> Option<$name> { - match self.overflowing_add(other) { - (_, true) => None, - (val, _) => Some(val), - } - } + /// Checked addition. Returns `None` if overflow occurred. + pub fn checked_add(self, other: $name) -> Option<$name> { + match self.overflowing_add(other) { + (_, true) => None, + (val, _) => Some(val), + } + } /// Subtraction which underflows and returns a flag if it does. #[inline(always)] @@ -837,13 +837,13 @@ macro_rules! construct_uint { } } - /// Checked subtraction. Returns `None` if overflow occurred. - pub fn checked_sub(self, other: $name) -> Option<$name> { - match self.overflowing_sub(other) { - (_, true) => None, - (val, _) => Some(val), - } - } + /// Checked subtraction. Returns `None` if overflow occurred. + pub fn checked_sub(self, other: $name) -> Option<$name> { + match self.overflowing_sub(other) { + (_, true) => None, + (val, _) => Some(val), + } + } /// Multiply with overflow, returning a flag if it does. #[inline(always)] @@ -859,27 +859,27 @@ macro_rules! construct_uint { } } - /// Checked multiplication. Returns `None` if overflow occurred. - pub fn checked_mul(self, other: $name) -> Option<$name> { - match self.overflowing_mul(other) { - (_, true) => None, - (val, _) => Some(val), - } - } + /// Checked multiplication. Returns `None` if overflow occurred. + pub fn checked_mul(self, other: $name) -> Option<$name> { + match self.overflowing_mul(other) { + (_, true) => None, + (val, _) => Some(val), + } + } /// Division with overflow pub fn overflowing_div(self, other: $name) -> ($name, bool) { (self / other, false) } - /// Checked division. Returns `None` if `other == 0`. - pub fn checked_div(self, other: $name) -> Option<$name> { - if other.is_zero() { - None - } else { - Some(self / other) - } - } + /// Checked division. Returns `None` if `other == 0`. + pub fn checked_div(self, other: $name) -> Option<$name> { + if other.is_zero() { + None + } else { + Some(self / other) + } + } /// Modulus with overflow. pub fn overflowing_rem(self, other: $name) -> ($name, bool) { @@ -888,11 +888,11 @@ macro_rules! construct_uint { /// Checked modulus. Returns `None` if `other == 0`. pub fn checked_rem(self, other: $name) -> Option<$name> { - if other.is_zero() { - None - } else { - Some(self % other) - } + if other.is_zero() { + None + } else { + Some(self % other) + } } /// Negation with overflow. @@ -904,13 +904,13 @@ macro_rules! construct_uint { } } - /// Checked negation. Returns `None` unless `self == 0`. - pub fn checked_neg(self) -> Option<$name> { - match self.overflowing_neg() { - (_, true) => None, - (zero, false) => Some(zero), - } - } + /// Checked negation. Returns `None` unless `self == 0`. + pub fn checked_neg(self) -> Option<$name> { + match self.overflowing_neg() { + (_, true) => None, + (zero, false) => Some(zero), + } + } /// Multiplication by u32 pub fn mul_u32(self, other: u32) -> Self {