Skip to content

Commit

Permalink
Fixed clippy screaming at me
Browse files Browse the repository at this point in the history
  • Loading branch information
markopoloparadox committed Oct 15, 2024
1 parent 6e584be commit fc9b1b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions core/src/from_substrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ pub struct HexDisplay<'a>(pub &'a [u8]);

impl<'a> sp_std::fmt::Display for HexDisplay<'a> {
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> Result<(), sp_std::fmt::Error> {
if self.0.len() < 1027 {
let len = self.0.len();
if len < 1027 {
for byte in self.0 {
f.write_fmt(format_args!("{:02x}", byte))?;
}
Expand All @@ -43,7 +44,8 @@ impl<'a> sp_std::fmt::Display for HexDisplay<'a> {
f.write_fmt(format_args!("{:02x}", byte))?;
}
f.write_str("...")?;
for byte in &self.0[self.0.len() - 512..] {
let start = len.saturating_sub(512);
for byte in &self.0[start..] {
f.write_fmt(format_args!("{:02x}", byte))?;
}
}
Expand Down

0 comments on commit fc9b1b0

Please sign in to comment.