Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Commit

Permalink
fix perthing add (paritytech#9638)
Browse files Browse the repository at this point in the history
  • Loading branch information
gui1117 authored Aug 27, 2021
1 parent ae70e6e commit 70a3bca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion primitives/arithmetic/src/per_things.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,10 +772,12 @@ macro_rules! implement_per_thing {
impl Add<Self> for $name {
type Output = $name;

// For PerU16, $max == u16::MAX, so we need this `allow`.
#[allow(unused_comparisons)]
#[inline]
fn add(self, rhs: Self) -> Self::Output {
let inner = self.deconstruct().add(rhs.deconstruct());
debug_assert!(inner < $max);
debug_assert!(inner <= $max);
$name::from_parts(inner)
}
}
Expand Down

0 comments on commit 70a3bca

Please sign in to comment.