mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
Auto merge of #4758 - mikerite:dec_lit_20191031, r=flip1995
`DecimalLiteralRepresentation` simplification Remove recalculation of literal value. changelog: none
This commit is contained in:
commit
426c05ae33
1 changed files with 1 additions and 6 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue