From 4e78547e6f65e2b5bdbdd46592f6882d6cd33628 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Thu, 31 Oct 2019 09:13:08 +0200 Subject: [PATCH] `DecimalLiteralRepresentation` simplification Remove recalculation of literal value. --- clippy_lints/src/literal_representation.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/clippy_lints/src/literal_representation.rs b/clippy_lints/src/literal_representation.rs index badd2237073c..09ef000994f2 100644 --- a/clippy_lints/src/literal_representation.rs +++ b/clippy_lints/src/literal_representation.rs @@ -509,17 +509,12 @@ impl DecimalLiteralRepresentation { fn check_lit(self, cx: &EarlyContext<'_>, lit: &Lit) { // Lint integral literals. if_chain! { - if let LitKind::Int(..) = lit.kind; + if let LitKind::Int(val, _) = lit.kind; if let Some(src) = snippet_opt(cx, lit.span); if let Some(firstch) = src.chars().next(); if char::to_digit(firstch, 10).is_some(); let digit_info = DigitInfo::new(&src, false); if digit_info.radix == Radix::Decimal; - if let Ok(val) = digit_info.digits - .chars() - .filter(|&c| c != '_') - .collect::() - .parse::(); if val >= u128::from(self.threshold); then { let hex = format!("{:#X}", val);