From 481b354c9719a538b21547fcf06b8f65a43da604 Mon Sep 17 00:00:00 2001 From: Lokathor Date: Fri, 1 Feb 2019 18:43:32 -0700 Subject: [PATCH] Simplify the overflowing_neg expression --- src/libcore/num/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 16364faa8000..2fbc5f7aa76c 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1530,7 +1530,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($Self #[inline] #[stable(feature = "wrapping", since = "1.7.0")] pub const fn overflowing_neg(self) -> (Self, bool) { - ((self ^ -1).wrapping_add(1), self == Self::min_value()) + ((!self).wrapping_add(1), self == Self::min_value()) } }