Skip to content

Commit 0ada4d3

Browse files
authored
dev: refactor to slices.Concat (#74)
1 parent 5af0fc4 commit 0ada4d3

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

sloglint.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,9 @@ func areArgsOnSameLine(fset *token.FileSet, call ast.Expr, keys, attrs []ast.Exp
418418
return false // special case: slog.Info("msg", "key", "value") is ok.
419419
}
420420

421-
l := len(keys) + len(attrs) + 1
422-
args := make([]ast.Expr, 0, l)
423-
args = append(args, call)
424-
args = append(args, keys...)
425-
args = append(args, attrs...)
421+
args := slices.Concat([]ast.Expr{call}, keys, attrs)
426422

427-
lines := make(map[int]struct{}, l)
423+
lines := make(map[int]struct{}, len(args))
428424
for _, arg := range args {
429425
line := fset.Position(arg.Pos()).Line
430426
if _, ok := lines[line]; ok {

0 commit comments

Comments
 (0)