Auto merge of #6114 - FliegendeWurst:no-mistyped-fraction, r=Manishearth

Do not lint float fractions in `mistyped_literal_suffixes`

As suggested in https://github.com/rust-lang/rust-clippy/issues/4706#issuecomment-544797928, the fractional part is now ignored (the integer part is checked instead).

Fixes: #4706

changelog: `mistyped_literal_suffixes` no longer warns on the fractional part of a float (e.g. 713.23_64)
This commit is contained in:
bors 2020-10-05 21:17:37 +00:00
commit 3239b46e92
4 changed files with 31 additions and 36 deletions

View file

@ -264,13 +264,10 @@ impl LiteralDigitGrouping {
let (part, mistyped_suffixes, missing_char) = if let Some((_, exponent)) = &mut num_lit.exponent {
(exponent, &["32", "64"][..], 'f')
} else if num_lit.fraction.is_some() {
(&mut num_lit.integer, &["32", "64"][..], 'f')
} else {
num_lit
.fraction
.as_mut()
.map_or((&mut num_lit.integer, &["8", "16", "32", "64"][..], 'i'), |fraction| {
(fraction, &["32", "64"][..], 'f')
})
(&mut num_lit.integer, &["8", "16", "32", "64"][..], 'i')
};
let mut split = part.rsplit('_');