Skip to content

Commit

Permalink
Avoid clippy ignores with saturating math
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Feb 4, 2025
1 parent 01e1c17 commit 2d39282
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions consensus/types/src/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ impl Encode for Checkpoint {
self.root.ssz_append(buf);
}

#[allow(clippy::arithmetic_side_effects)]
fn ssz_bytes_len(&self) -> usize {
self.epoch.ssz_bytes_len() + self.root.ssz_bytes_len()
self.epoch
.ssz_bytes_len()
.saturating_add(self.root.ssz_bytes_len())
}
}

Expand All @@ -54,9 +55,8 @@ impl Decode for Checkpoint {
true
}

#[allow(clippy::arithmetic_side_effects)]
fn ssz_fixed_len() -> usize {
<Epoch as Decode>::ssz_fixed_len() + <Hash256 as Decode>::ssz_fixed_len()
<Epoch as Decode>::ssz_fixed_len().saturating_add(<Hash256 as Decode>::ssz_fixed_len())
}

fn from_ssz_bytes(bytes: &[u8]) -> Result<Self, ssz::DecodeError> {
Expand Down

0 comments on commit 2d39282

Please sign in to comment.