mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
Refactor check_lit method
This commit is contained in:
parent
1fd2451b90
commit
ab6b949224
@ -526,24 +526,20 @@ impl LiteralRepresentation {
|
||||
if let Some(src) = snippet_opt(cx, lit.span);
|
||||
if let Some(firstch) = src.chars().next();
|
||||
if char::to_digit(firstch, 10).is_some();
|
||||
then {
|
||||
let digit_info = DigitInfo::new(&src, false);
|
||||
if digit_info.radix == Radix::Decimal {
|
||||
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) {
|
||||
return
|
||||
}
|
||||
.parse::<u128>();
|
||||
if val >= u128::from(self.threshold);
|
||||
then {
|
||||
let hex = format!("{:#X}", val);
|
||||
let digit_info = DigitInfo::new(&hex, false);
|
||||
let _ = Self::do_lint(digit_info.digits).map_err(|warning_type| {
|
||||
warning_type.display(&digit_info.grouping_hint(), cx, lit.span)
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user