1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

fmt: remove trailing space in comments (#9620)

This commit is contained in:
Lukas Neubert 2021-04-07 15:25:11 +02:00 committed by GitHub
parent 6d77c8821b
commit 1d5ed89138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 40 additions and 20 deletions

View File

@ -44,7 +44,7 @@ pub fn (mut f Fmt) comment(node ast.Comment, options CommentsOptions) {
}
} else if !node.text.contains('\n') {
is_separate_line := !options.inline || node.text.starts_with('\x01')
mut s := node.text.trim_left('\x01')
mut s := node.text.trim_left('\x01').trim_right(' ')
mut out_s := '//'
if s != '' {
if is_char_alphanumeric(s[0]) {
@ -67,7 +67,7 @@ pub fn (mut f Fmt) comment(node ast.Comment, options CommentsOptions) {
f.writeln('')
}
for line in lines {
f.writeln(line)
f.writeln(line.trim_right(' '))
f.empty_line = false
}
if end_break {

View File

@ -0,0 +1,10 @@
// NB: The input file has and *should* have trailing spaces.
// When making changes, please ensure these spaces are not removed.
fn comments_with_trailing_space() {
// two spaces on the right
/*
spaces after here
and everywhere :)
*/
}

View File

@ -0,0 +1,10 @@
// NB: The input file has and *should* have trailing spaces.
// When making changes, please ensure these spaces are not removed.
fn comments_with_trailing_space() {
// two spaces on the right
/*
spaces after here
and everywhere :)
*/
}