fix: correct zero hex formatting (#195)

* fix: correct zero hex formatting

* clippy
This commit is contained in:
Noah Citron 2023-02-12 12:16:11 -05:00 committed by GitHub
parent 32d09736e0
commit ef5a6a216f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -342,5 +342,11 @@ fn format_hex(num: &U256) -> String {
.trim_start_matches('0')
.to_string();
let stripped = if stripped.is_empty() {
"0".to_string()
} else {
stripped
};
format!("0x{stripped}")
}