Introduce local variable
To make the stripping of the prefix a little clearer introduce a local variable. Refactor only, no logic changes.
This commit is contained in:
parent
1269722770
commit
cf65bf035f
|
@ -92,7 +92,8 @@ pub fn int<T: Integer, S: AsRef<str> + Into<String>>(s: S) -> Result<T, ParseInt
|
||||||
///
|
///
|
||||||
/// Input string may or may not contain a `0x` prefix.
|
/// Input string may or may not contain a `0x` prefix.
|
||||||
pub fn hex_u32<S: AsRef<str> + Into<String>>(s: S) -> Result<u32, ParseIntError> {
|
pub fn hex_u32<S: AsRef<str> + Into<String>>(s: S) -> Result<u32, ParseIntError> {
|
||||||
u32::from_str_radix(strip_hex_prefix(s.as_ref()), 16).map_err(|error| ParseIntError {
|
let stripped = strip_hex_prefix(s.as_ref());
|
||||||
|
u32::from_str_radix(stripped, 16).map_err(|error| ParseIntError {
|
||||||
input: s.into(),
|
input: s.into(),
|
||||||
bits: 32,
|
bits: 32,
|
||||||
is_signed: false,
|
is_signed: false,
|
||||||
|
|
Loading…
Reference in New Issue