diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index bb7e7b4f7f7bc..f84eef77ffd2f 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -516,8 +516,7 @@ macro_rules! int_impl { ); // SAFETY: this is guaranteed to be safe by the caller. unsafe { - let lhs = self; - intrinsics::unchecked_add(lhs, rhs) + intrinsics::unchecked_add(self, rhs) } } @@ -660,8 +659,7 @@ macro_rules! int_impl { ); // SAFETY: this is guaranteed to be safe by the caller. unsafe { - let lhs = self; - intrinsics::unchecked_sub(lhs, rhs) + intrinsics::unchecked_sub(self, rhs) } } @@ -804,8 +802,7 @@ macro_rules! int_impl { ); // SAFETY: this is guaranteed to be safe by the caller. unsafe { - let lhs = self; - intrinsics::unchecked_mul(lhs, rhs) + intrinsics::unchecked_mul(self, rhs) } } @@ -1272,9 +1269,7 @@ macro_rules! int_impl { // SAFETY: this is guaranteed to be safe by the caller. // Any legal shift amount is losslessly representable in the self type. unsafe { - let lhs = self; - let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs); - intrinsics::unchecked_shl(lhs, rhs) + intrinsics::unchecked_shl(self, conv_rhs_for_unchecked_shift!($SelfT, rhs)) } } @@ -1362,9 +1357,7 @@ macro_rules! int_impl { // SAFETY: this is guaranteed to be safe by the caller. // Any legal shift amount is losslessly representable in the self type. unsafe { - let lhs = self; - let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs); - intrinsics::unchecked_shr(lhs, rhs) + intrinsics::unchecked_shl(self, conv_rhs_for_unchecked_shift!($SelfT, rhs)) } } @@ -2031,8 +2024,7 @@ macro_rules! int_impl { unsafe { // FIXME: we can't optimize out the extra check here, // so, we can't just call the method for now - let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs & (Self::BITS - 1)); - intrinsics::unchecked_shl(self, rhs) + intrinsics::unchecked_shl(self, conv_rhs_for_unchecked_shift!($SelfT, rhs & (Self::BITS - 1))) } } @@ -2064,8 +2056,7 @@ macro_rules! int_impl { unsafe { // FIXME: we can't optimize out the extra check here, // so, we can't just call the method for now - let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs & (Self::BITS - 1)); - intrinsics::unchecked_shr(self, rhs) + intrinsics::unchecked_shr(self, conv_rhs_for_unchecked_shift!($SelfT, rhs & (Self::BITS - 1))) } } diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index 849e8c51242b3..984e5ef801515 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -525,8 +525,7 @@ macro_rules! uint_impl { // SAFETY: this is guaranteed to be safe by the caller. unsafe { - let lhs = self; - intrinsics::unchecked_add(lhs, rhs) + intrinsics::unchecked_add(self, rhs) } } @@ -675,8 +674,7 @@ macro_rules! uint_impl { ); // SAFETY: this is guaranteed to be safe by the caller. unsafe { - let lhs = self; - intrinsics::unchecked_sub(lhs, rhs) + intrinsics::unchecked_sub(self, rhs) } } @@ -763,8 +761,7 @@ macro_rules! uint_impl { ); // SAFETY: this is guaranteed to be safe by the caller. unsafe { - let lhs = self; - intrinsics::unchecked_mul(lhs, rhs) + intrinsics::unchecked_mul(self, rhs) } } @@ -1327,9 +1324,7 @@ macro_rules! uint_impl { // SAFETY: this is guaranteed to be safe by the caller. // Any legal shift amount is losslessly representable in the self type. unsafe { - let lhs = self; - let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs); - intrinsics::unchecked_shl(lhs, rhs) + intrinsics::unchecked_shl(self, conv_rhs_for_unchecked_shift!($SelfT, rhs)) } } @@ -1417,9 +1412,7 @@ macro_rules! uint_impl { // SAFETY: this is guaranteed to be safe by the caller. // Any legal shift amount is losslessly representable in the self type. unsafe { - let lhs = self; - let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs); - intrinsics::unchecked_shr(lhs, rhs) + intrinsics::unchecked_shr(self, conv_rhs_for_unchecked_shift!($SelfT, rhs)) } } @@ -1913,8 +1906,7 @@ macro_rules! uint_impl { unsafe { // FIXME: we can't optimize out the extra check here, // so, we can't just call the method for now - let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs & (Self::BITS - 1)); - intrinsics::unchecked_shl(self, rhs) + intrinsics::unchecked_shl(self, conv_rhs_for_unchecked_shift!($SelfT, rhs & (Self::BITS - 1))) } } @@ -1949,8 +1941,7 @@ macro_rules! uint_impl { unsafe { // FIXME: we can't optimize out the extra check here, // so, we can't just call the method for now - let rhs = conv_rhs_for_unchecked_shift!($SelfT, rhs & (Self::BITS - 1)); - intrinsics::unchecked_shr(self, rhs) + intrinsics::unchecked_shr(self, conv_rhs_for_unchecked_shift!($SelfT, rhs & (Self::BITS - 1))) } }