rename checked_impl_one_param to checked_impl_unary
This commit is contained in:
parent
f74de249c8
commit
5fb3724b69
|
@ -107,8 +107,7 @@ checked_impl!(CheckedRem, checked_rem, i32);
|
||||||
checked_impl!(CheckedRem, checked_rem, i64);
|
checked_impl!(CheckedRem, checked_rem, i64);
|
||||||
checked_impl!(CheckedRem, checked_rem, isize);
|
checked_impl!(CheckedRem, checked_rem, isize);
|
||||||
|
|
||||||
// CheckedNeg
|
macro_rules! checked_impl_unary {
|
||||||
macro_rules! checked_impl_one_para {
|
|
||||||
($trait_name:ident, $method:ident, $t:ty) => {
|
($trait_name:ident, $method:ident, $t:ty) => {
|
||||||
impl $trait_name for $t {
|
impl $trait_name for $t {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -123,17 +122,17 @@ pub trait CheckedNeg: Sized {
|
||||||
fn checked_neg(&self) -> Option<Self>;
|
fn checked_neg(&self) -> Option<Self>;
|
||||||
}
|
}
|
||||||
|
|
||||||
checked_impl_one_para!(CheckedNeg, checked_neg, u8);
|
checked_impl_unary!(CheckedNeg, checked_neg, u8);
|
||||||
checked_impl_one_para!(CheckedNeg, checked_neg, u16);
|
checked_impl_unary!(CheckedNeg, checked_neg, u16);
|
||||||
checked_impl_one_para!(CheckedNeg, checked_neg, u32);
|
checked_impl_unary!(CheckedNeg, checked_neg, u32);
|
||||||
checked_impl_one_para!(CheckedNeg, checked_neg, u64);
|
checked_impl_unary!(CheckedNeg, checked_neg, u64);
|
||||||
checked_impl_one_para!(CheckedNeg, checked_neg, usize);
|
checked_impl_unary!(CheckedNeg, checked_neg, usize);
|
||||||
|
|
||||||
checked_impl_one_para!(CheckedNeg, checked_neg, i8);
|
checked_impl_unary!(CheckedNeg, checked_neg, i8);
|
||||||
checked_impl_one_para!(CheckedNeg, checked_neg, i16);
|
checked_impl_unary!(CheckedNeg, checked_neg, i16);
|
||||||
checked_impl_one_para!(CheckedNeg, checked_neg, i32);
|
checked_impl_unary!(CheckedNeg, checked_neg, i32);
|
||||||
checked_impl_one_para!(CheckedNeg, checked_neg, i64);
|
checked_impl_unary!(CheckedNeg, checked_neg, i64);
|
||||||
checked_impl_one_para!(CheckedNeg, checked_neg, isize);
|
checked_impl_unary!(CheckedNeg, checked_neg, isize);
|
||||||
|
|
||||||
/// Performs a left shift that returns `None` on overflow.
|
/// Performs a left shift that returns `None` on overflow.
|
||||||
pub trait CheckedShl: Sized + Shl<u32, Output=Self> {
|
pub trait CheckedShl: Sized + Shl<u32, Output=Self> {
|
||||||
|
|
Loading…
Reference in New Issue