Skip to content

Commit

Permalink
[logs] remove zero padding on address string display to make operatio…
Browse files Browse the repository at this point in the history
…nal logs easier to read. Legacy 0L addresses have 32 zero padding
  • Loading branch information
0o-de-lally committed Nov 29, 2023
1 parent 5b5c097 commit db1137b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/short-hex-str/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ impl ShortHexStr {
// We could also do str::from_utf8_unchecked here to avoid the unnecessary
// runtime check. Shaves ~6-7 ns/iter in a micro bench but the unsafe is
// probably not worth the hassle.
str::from_utf8(&self.0).expect(
let s = str::from_utf8(&self.0).expect(
"This can never fail since &self.0 will only ever contain the \
following characters: '0123456789abcdef', which are all valid \
ASCII characters and therefore all valid UTF-8",
)
).trim_start_matches("0"); //////// 0L //////// many addresses are padded after v5 conversion
s
}
}

Expand Down

0 comments on commit db1137b

Please sign in to comment.