Skip to content

Commit 42f2304

Browse files
committed
Drop exponent suggestion when 0
This commit changes numeric literal formatting to drop exponent when exponent is 0.
1 parent b9dedf3 commit 42f2304

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

clippy_utils/src/numeric_literal.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,10 @@ impl<'a> NumericLiteral<'a> {
157157
}
158158

159159
if let Some((separator, exponent)) = self.exponent {
160-
output.push_str(separator);
161-
Self::group_digits(&mut output, exponent, group_size, true, false);
160+
if exponent != "0" {
161+
output.push_str(separator);
162+
Self::group_digits(&mut output, exponent, group_size, true, false);
163+
}
162164
}
163165

164166
if let Some(suffix) = self.suffix {

0 commit comments

Comments
 (0)