Skip to content

Commit b753ffd

Browse files
authored
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.
2 parents 4934f6f + d7fd1d5 commit b753ffd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

library/core/src/num/int_macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ macro_rules! int_impl {
869869
// Deal with the final bit of the exponent separately, since
870870
// squaring the base afterwards is not necessary and may cause a
871871
// needless overflow.
872-
Some(try_opt!(acc.checked_mul(base)))
872+
acc.checked_mul(base)
873873
}
874874

875875
/// Saturating integer addition. Computes `self + rhs`, saturating at the numeric

library/core/src/num/uint_macros.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ macro_rules! uint_impl {
990990
// squaring the base afterwards is not necessary and may cause a
991991
// needless overflow.
992992

993-
Some(try_opt!(acc.checked_mul(base)))
993+
acc.checked_mul(base)
994994
}
995995

996996
/// Saturating integer addition. Computes `self + rhs`, saturating at

0 commit comments

Comments
 (0)