about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2022-10-17 11:21:50 -0700
committerJosh Stone <jistone@redhat.com>2022-10-17 11:21:50 -0700
commitd7fd1d57ec90d43aee3caee75a9663914ccc1400 (patch)
treeb6aa0e83b90bf06b95a6aa39c3c8cd3ac038d4f3
parenta9d1cafa878ecc04a4aa7aaa7df0414a29a2bd0b (diff)
downloadrust-d7fd1d57ec90d43aee3caee75a9663914ccc1400.tar.gz
rust-d7fd1d57ec90d43aee3caee75a9663914ccc1400.zip
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.
-rw-r--r--library/core/src/num/int_macros.rs2
-rw-r--r--library/core/src/num/uint_macros.rs2
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 b413a85fee3..81f050cb283 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 b177e5e3900..f186b468e64 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