From 13c78a1285117b6daf3414880ab0f2d70193caa4 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Wed, 31 May 2023 15:24:22 +0200 Subject: [PATCH] fix hex integer clippy suggestions --- src/token/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/token/mod.rs b/src/token/mod.rs index ddf9656..f1194fb 100644 --- a/src/token/mod.rs +++ b/src/token/mod.rs @@ -443,10 +443,10 @@ pub(crate) fn tokenize(string: &str) -> EvalexprResult> { } fn parse_dec_or_hex(literal: &str) -> Result { - 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) } }