Rust-clippy: inconsistent_digit_grouping is inconsistent when a floating point exponent used

Created on 29 Sep 2020  路  2Comments  路  Source: rust-lang/rust-clippy

The inconsistent_digit_grouping is inconsistent when a floating point exponent is used. e.g. 1.234E1.

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=c4df1f0f3ccc3411adf952eba66cf300

fn main() {
    let a = 1.025_011_10E0;
    let b = 1.025_011_10_E0;

    println!("{}", a);
    println!("{}", b);
}

I expected to see this happen: No warning is displayed for either literal.

Instead, this happened: A inconsistent_digit_grouping warning is displayed only for the literal assigned to b.

It looks like the final _ before the E binds to the fractional portion of the number rather than the exponent. It would be good if an _ before the E did not group with the fractional portion so that an _ can be used to make the E stand out from the digits.

Meta

  • cargo clippy -V: e.g. clippy 0.0.212 (f455e46 2020-06-20)
  • rustc -Vv:
    rustc 1.46.0-nightly (f455e46ea 2020-06-20) binary: rustc commit-hash: f455e46eae1a227d735091091144601b467e1565 commit-date: 2020-06-20 host: x86_64-unknown-linux-gnu release: 1.46.0-nightly LLVM version: 10.0
L-bug

Most helpful comment

I'll fix this one.

All 2 comments

I'll fix this one.

Thanks @mikerite!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

f-fr picture f-fr  路  3Comments

vitorenesduarte picture vitorenesduarte  路  3Comments

jyn514 picture jyn514  路  3Comments

matthiaskrgr picture matthiaskrgr  路  3Comments

nbaksalyar picture nbaksalyar  路  3Comments