units: Fix cargo cult programming
When creating the ParseIntError in `hex_u32` I (Tobin) just cargo cult programmed the generic stuff without thinking. - The `is_signed` field is used to denote whether we were attempting to parse a signed or unsigned integer, it should be `false`. - The `bits` field should be directly set to 32.
This commit is contained in:
parent
7b7461c5d9
commit
290e4418e6
|
@ -108,8 +108,8 @@ pub(crate) fn strip_hex_prefix(s: &str) -> &str {
|
|||
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 {
|
||||
input: s.into(),
|
||||
bits: u8::try_from(core::mem::size_of::<u32>() * 8).expect("max is 32 bits for u32"),
|
||||
is_signed: u32::try_from(-1i8).is_ok(),
|
||||
bits: 32,
|
||||
is_signed: false,
|
||||
source: error,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue