Update checked.rs

This commit is contained in:
LEXUGE 2018-04-05 19:16:07 +08:00 committed by GitHub
parent 42b2ef81c0
commit ca343c0af2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -111,8 +111,8 @@ macro_rules! checked_abs_impl {
($t:ty) => {
impl CheckedAbs for $t {
#[inline]
fn checked_abs(&self) -> Option<$t> {
<$t>::checked_abs(*self)
fn checked_abs(self) -> Option<$t> {
<$t>::checked_abs(self)
}
}
}
@ -120,7 +120,7 @@ macro_rules! checked_abs_impl {
// CheckedAbs
pub trait CheckedAbs: Sized {
fn checked_abs(&self) -> Option<i32>;
fn checked_abs(self) -> Option<i32>;
}
checked_abs_impl!(u8);