Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Prevent panics"
This reverts commit 7e88ac7.
  • Loading branch information
ggwpez committed Mar 21, 2023
commit 5796b306fc3bd3e349d5101f15a611caf22e02e3
8 changes: 0 additions & 8 deletions primitives/arithmetic/src/per_things.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,6 @@ where
P::Inner: Into<N>,
{
let maximum: N = P::ACCURACY.into();
if part.is_zero() {
// Division by zero... best effort to prevent a panic.
return maximum
}
let c = rational_mul_correction::<N, P>(x.clone(), P::ACCURACY, part, rounding);
(x / part.into()).saturating_mul(maximum).saturating_add(c)
}
Expand Down Expand Up @@ -513,10 +509,6 @@ where
let numer_upper = P::Upper::from(numer);
let denom_n: N = denom.into();
let denom_upper = P::Upper::from(denom);
if denom.is_zero() {
// Division by zero... best effort to prevent a panic.
return N::one()
}
let rem = x.rem(denom_n);
// `rem` is less than `denom`, which fits in `P::Inner`.
let rem_inner = rem.saturated_into::<P::Inner>();
Expand Down