1
Fork 0

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.
This commit is contained in:
Yuki Okushi 2022-10-18 21:21:31 +09:00 committed by GitHub
commit e04bbcb9b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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