fix hex integer clippy suggestions

This commit is contained in:
Kaspar Schleiser 2023-05-31 15:24:22 +02:00 committed by ISibboI
parent f6596b13ec
commit 13c78a1285

View File

@ -443,10 +443,10 @@ pub(crate) fn tokenize(string: &str) -> EvalexprResult<Vec<Token>> {
}
fn parse_dec_or_hex(literal: &str) -> Result<IntType, std::num::ParseIntError> {
if literal.starts_with("0x") {
IntType::from_str_radix(&literal[2..], 16)
if let Some(literal) = literal.strip_prefix("0x") {
IntType::from_str_radix(literal, 16)
} else {
IntType::from_str_radix(&literal, 10)
IntType::from_str_radix(literal, 10)
}
}