Skip to content

Commit e1a48d6

Browse files
authored
fmt: simplify formatting struct field comments (#19373)
1 parent ec0d5dd commit e1a48d6

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

vlib/v/fmt/struct.v

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl, is_anon bool) {
3838
field_types << ft
3939
attrs_len := inline_attrs_len(field.attrs)
4040
end_pos := field.pos.pos + field.pos.len
41-
mut comments_len := 0 // Length of comments between field name and type
4241
for comment in field.comments {
4342
if comment.pos.pos >= end_pos {
4443
if comment.pos.line_nr == field.pos.line_nr {
@@ -48,11 +47,8 @@ pub fn (mut f Fmt) struct_decl(node ast.StructDecl, is_anon bool) {
4847
}
4948
continue
5049
}
51-
if comment.pos.pos > field.pos.pos {
52-
comments_len += '/* ${comment.text.trim_left('\x01')} */ '.len
53-
}
5450
}
55-
field_aligns.add_info(comments_len + field.name.len, ft.len, field.pos.line_nr)
51+
field_aligns.add_info(field.name.len, ft.len, field.pos.line_nr)
5652
if field.has_default_expr {
5753
default_expr_aligns.add_info(attrs_len, field_types[i].len, field.pos.line_nr,
5854
use_threshold: true

0 commit comments

Comments
 (0)