Unindent nonzero_integer_impl_div_rem macro body
This commit is contained in:
parent
81e1a7c6b5
commit
a78d9a6de1
@ -283,30 +283,30 @@ macro_rules! nonzero_integer_impl_div_rem {
|
||||
};
|
||||
|
||||
($Ty:ident unsigned $Int:ty) => {
|
||||
#[stable(feature = "nonzero_div", since = "1.51.0")]
|
||||
impl Div<$Ty> for $Int {
|
||||
type Output = $Int;
|
||||
/// This operation rounds towards zero,
|
||||
/// truncating any fractional part of the exact result, and cannot panic.
|
||||
#[inline]
|
||||
fn div(self, other: $Ty) -> $Int {
|
||||
// SAFETY: div by zero is checked because `other` is a nonzero,
|
||||
// and MIN/-1 is checked because `self` is an unsigned int.
|
||||
unsafe { crate::intrinsics::unchecked_div(self, other.get()) }
|
||||
}
|
||||
#[stable(feature = "nonzero_div", since = "1.51.0")]
|
||||
impl Div<$Ty> for $Int {
|
||||
type Output = $Int;
|
||||
/// This operation rounds towards zero,
|
||||
/// truncating any fractional part of the exact result, and cannot panic.
|
||||
#[inline]
|
||||
fn div(self, other: $Ty) -> $Int {
|
||||
// SAFETY: div by zero is checked because `other` is a nonzero,
|
||||
// and MIN/-1 is checked because `self` is an unsigned int.
|
||||
unsafe { crate::intrinsics::unchecked_div(self, other.get()) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "nonzero_div", since = "1.51.0")]
|
||||
impl Rem<$Ty> for $Int {
|
||||
type Output = $Int;
|
||||
/// This operation satisfies `n % d == n - (n / d) * d`, and cannot panic.
|
||||
#[inline]
|
||||
fn rem(self, other: $Ty) -> $Int {
|
||||
// SAFETY: rem by zero is checked because `other` is a nonzero,
|
||||
// and MIN/-1 is checked because `self` is an unsigned int.
|
||||
unsafe { crate::intrinsics::unchecked_rem(self, other.get()) }
|
||||
}
|
||||
#[stable(feature = "nonzero_div", since = "1.51.0")]
|
||||
impl Rem<$Ty> for $Int {
|
||||
type Output = $Int;
|
||||
/// This operation satisfies `n % d == n - (n / d) * d`, and cannot panic.
|
||||
#[inline]
|
||||
fn rem(self, other: $Ty) -> $Int {
|
||||
// SAFETY: rem by zero is checked because `other` is a nonzero,
|
||||
// and MIN/-1 is checked because `self` is an unsigned int.
|
||||
unsafe { crate::intrinsics::unchecked_rem(self, other.get()) }
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user