From d7fd1d57ec90d43aee3caee75a9663914ccc1400 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 17 Oct 2022 11:21:50 -0700 Subject: [PATCH] Remove the redundant `Some(try_opt!(..))` in `checked_pow` The final return value doesn't need to be tried at all -- we can just return the checked option directly. The optimizer can probably figure this out anyway, but there's no need to make it work here. --- library/core/src/num/int_macros.rs | 2 +- library/core/src/num/uint_macros.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index b413a85fee340..81f050cb283d4 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -869,7 +869,7 @@ macro_rules! int_impl { // Deal with the final bit of the exponent separately, since // squaring the base afterwards is not necessary and may cause a // needless overflow. - Some(try_opt!(acc.checked_mul(base))) + acc.checked_mul(base) } /// Saturating integer addition. Computes `self + rhs`, saturating at the numeric diff --git a/library/core/src/num/uint_macros.rs b/library/core/src/num/uint_macros.rs index b177e5e390028..f186b468e64cb 100644 --- a/library/core/src/num/uint_macros.rs +++ b/library/core/src/num/uint_macros.rs @@ -990,7 +990,7 @@ macro_rules! uint_impl { // squaring the base afterwards is not necessary and may cause a // needless overflow. - Some(try_opt!(acc.checked_mul(base))) + acc.checked_mul(base) } /// Saturating integer addition. Computes `self + rhs`, saturating at