Skip to content

Commit

Permalink
Rollup merge of rust-lang#4758 - mikerite:dec_lit_20191031, r=flip1995
Browse files Browse the repository at this point in the history
`DecimalLiteralRepresentation` simplification

Remove recalculation of literal value.

changelog: none
  • Loading branch information
flip1995 authored Nov 7, 2019
2 parents 53a99cd + 4e78547 commit 27b4522
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions clippy_lints/src/literal_representation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<String>()
.parse::<u128>();
if val >= u128::from(self.threshold);
then {
let hex = format!("{:#X}", val);
Expand Down

0 comments on commit 27b4522

Please sign in to comment.