Skip to content

Commit ce5d22e

Browse files
committed
Auto merge of #4758 - mikerite:dec_lit_20191031, r=flip1995
`DecimalLiteralRepresentation` simplification Remove recalculation of literal value. changelog: none
2 parents 000c3ff + 4e78547 commit ce5d22e

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

clippy_lints/src/literal_representation.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -509,17 +509,12 @@ impl DecimalLiteralRepresentation {
509509
fn check_lit(self, cx: &EarlyContext<'_>, lit: &Lit) {
510510
// Lint integral literals.
511511
if_chain! {
512-
if let LitKind::Int(..) = lit.kind;
512+
if let LitKind::Int(val, _) = lit.kind;
513513
if let Some(src) = snippet_opt(cx, lit.span);
514514
if let Some(firstch) = src.chars().next();
515515
if char::to_digit(firstch, 10).is_some();
516516
let digit_info = DigitInfo::new(&src, false);
517517
if digit_info.radix == Radix::Decimal;
518-
if let Ok(val) = digit_info.digits
519-
.chars()
520-
.filter(|&c| c != '_')
521-
.collect::<String>()
522-
.parse::<u128>();
523518
if val >= u128::from(self.threshold);
524519
then {
525520
let hex = format!("{:#X}", val);

0 commit comments

Comments
 (0)