From 4e8cd4d346c13b0ef873f69c213ba96dc5bab5bf Mon Sep 17 00:00:00 2001 From: Yoshitomo Nakanishi Date: Tue, 13 Jul 2021 22:56:41 +0900 Subject: [PATCH] Fix `NumericLiteral::format` that may produce a invalid literal --- clippy_utils/src/numeric_literal.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/clippy_utils/src/numeric_literal.rs b/clippy_utils/src/numeric_literal.rs index 546706d51d7..4a28c7dd9a0 100644 --- a/clippy_utils/src/numeric_literal.rs +++ b/clippy_utils/src/numeric_literal.rs @@ -162,6 +162,9 @@ pub fn format(&self) -> String { } if let Some(suffix) = self.suffix { + if output.ends_with('.') { + output.push('0'); + } output.push('_'); output.push_str(suffix); }