diff --git a/src/bin/hexyl.rs b/src/bin/hexyl.rs index e85ac59..0e39fe3 100644 --- a/src/bin/hexyl.rs +++ b/src/bin/hexyl.rs @@ -162,8 +162,10 @@ fn main() { } fn parse_hex_or_int(n: &str) -> Option { - if n.starts_with("0x") { - let n = n.trim_start_matches("0x"); + const HEX_PREFIX: &'static str = "0x"; + + if n.starts_with(HEX_PREFIX) { + let n = n.trim_start_matches(HEX_PREFIX); if n.chars().next() == Some('+') { return None; }