diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2022-10-18 21:21:31 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-10-18 21:21:31 +0900 |
| commit | e04bbcb9b1e8f13c09252c7a43011a6b0c9b8dba (patch) | |
| tree | 2de5aaa6755e7c08b1c02928ea717710189a03e3 /library/core | |
| parent | ba643786b8799242184682b4caa7911756fe4046 (diff) | |
| parent | d7fd1d57ec90d43aee3caee75a9663914ccc1400 (diff) | |
| download | rust-e04bbcb9b1e8f13c09252c7a43011a6b0c9b8dba.tar.gz rust-e04bbcb9b1e8f13c09252c7a43011a6b0c9b8dba.zip | |
Rollup merge of #103159 - cuviper:check_pow-final-try_opt, r=Mark-Simulacrum
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.
Diffstat (limited to 'library/core')
| -rw-r--r-- | library/core/src/num/int_macros.rs | 2 | ||||
| -rw-r--r-- | 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 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 |
