From 47a8051b13abc7d64c9f0b22ad416a0be50d443e Mon Sep 17 00:00:00 2001 From: yuyi Date: Tue, 5 Dec 2023 02:59:11 +0800 Subject: [PATCH] fmt: cleanup comments.v with multiline comment (#20086) --- vlib/v/fmt/comments.v | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/vlib/v/fmt/comments.v b/vlib/v/fmt/comments.v index 6bb41c2008d768..da08b98a3a53b4 100644 --- a/vlib/v/fmt/comments.v +++ b/vlib/v/fmt/comments.v @@ -61,16 +61,14 @@ pub fn (mut f Fmt) comment(node ast.Comment, options CommentsOptions) { lines := node.text.split_into_lines() f.write('/*') for i, line in lines { + f.empty_line = false if i == lines.len - 1 { - f.empty_line = false + f.write(line) if node.text[node.text.len - 1] == `\n` { - f.writeln(line) - } else { - f.write(line) + f.writeln('') } f.write('*/') } else { - f.empty_line = false f.writeln(line.trim_right(' ')) } }