Unverified Commit 07ecad71 authored by Squirrel's avatar Squirrel Committed by GitHub
Browse files

simplify hex parsing (#628)

parent 64d33a54
Pipeline #201114 passed with stages
in 13 minutes
...@@ -137,11 +137,7 @@ pub(crate) fn base_name(path: &Path) -> &str { ...@@ -137,11 +137,7 @@ pub(crate) fn base_name(path: &Path) -> &str {
/// Decode hex string with or without 0x prefix /// Decode hex string with or without 0x prefix
pub fn decode_hex(input: &str) -> Result<Vec<u8>, hex::FromHexError> { pub fn decode_hex(input: &str) -> Result<Vec<u8>, hex::FromHexError> {
if input.starts_with("0x") {
hex::decode(input.trim_start_matches("0x")) hex::decode(input.trim_start_matches("0x"))
} else {
hex::decode(input)
}
} }
/// Prints to stdout if `verbosity.is_verbose()` is `true`. /// Prints to stdout if `verbosity.is_verbose()` is `true`.
......
...@@ -16,9 +16,5 @@ ...@@ -16,9 +16,5 @@
/// Decode hex string with or without 0x prefix /// Decode hex string with or without 0x prefix
pub fn decode_hex(input: &str) -> Result<Vec<u8>, hex::FromHexError> { pub fn decode_hex(input: &str) -> Result<Vec<u8>, hex::FromHexError> {
if input.starts_with("0x") {
hex::decode(input.trim_start_matches("0x")) hex::decode(input.trim_start_matches("0x"))
} else {
hex::decode(input)
}
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment