Skip to content

Commit 8a109b0

Browse files
author
Lukas Neubert
authored
fmt: minor optimization in call_expr (#10228)
1 parent df2b688 commit 8a109b0

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

vlib/v/fmt/fmt.v

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ pub fn (mut f Fmt) node_str(node ast.Node) string {
354354
ast.Expr { f.expr(node) }
355355
else { panic('´f.node_str()´ is not implemented for ${node}.') }
356356
}
357-
str := f.out.after(pos).trim_space()
357+
str := f.out.after(pos)
358358
f.out.go_back_to(pos)
359359
f.empty_line = was_empty_line
360360
f.line_len = prev_line_len
@@ -1616,9 +1616,6 @@ pub fn (mut f Fmt) call_expr(node ast.CallExpr) {
16161616
} else {
16171617
mut name := f.short_module(node.name)
16181618
f.mark_import_as_used(name)
1619-
if node.name in f.mod2alias {
1620-
name = f.mod2alias[node.name]
1621-
}
16221619
f.write('$name')
16231620
}
16241621
}
@@ -2116,7 +2113,7 @@ fn (mut f Fmt) match_branch(branch ast.MatchBranch, single_line bool) {
21162113
// normal branch
21172114
f.is_mbranch_expr = true
21182115
for j, expr in branch.exprs {
2119-
estr := f.node_str(expr)
2116+
estr := f.node_str(expr).trim_space()
21202117
if f.line_len + estr.len + 2 > fmt.max_len[5] {
21212118
f.remove_new_line({})
21222119
f.writeln('')

0 commit comments

Comments
 (0)