Skip to content

Commit

Permalink
Drop exponent suggestion when 0
Browse files Browse the repository at this point in the history
This commit changes numeric literal formatting to drop exponent when
exponent is 0.
  • Loading branch information
dswij committed Oct 6, 2021
1 parent b9dedf3 commit 42f2304
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions clippy_utils/src/numeric_literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ impl<'a> NumericLiteral<'a> {
}

if let Some((separator, exponent)) = self.exponent {
output.push_str(separator);
Self::group_digits(&mut output, exponent, group_size, true, false);
if exponent != "0" {
output.push_str(separator);
Self::group_digits(&mut output, exponent, group_size, true, false);
}
}

if let Some(suffix) = self.suffix {
Expand Down

0 comments on commit 42f2304

Please sign in to comment.