zig fmt: fix rendering of struct with no trailing comma on last field
parent
0ab888c639
commit
0bef1f9824
|
@ -1,3 +1,18 @@
|
|||
test "zig fmt: no trailing comma on struct decl" {
|
||||
try testTransform(
|
||||
\\const RoundParam = struct {
|
||||
\\ k: usize, s: u32, t: u32
|
||||
\\};
|
||||
,
|
||||
\\const RoundParam = struct {
|
||||
\\ k: usize,
|
||||
\\ s: u32,
|
||||
\\ t: u32,
|
||||
\\};
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: simple asm" {
|
||||
try testTransform(
|
||||
\\comptime {
|
||||
|
|
|
@ -102,8 +102,7 @@ fn renderTopLevelDecl(allocator: &mem.Allocator, stream: var, tree: &ast.Tree, i
|
|||
}
|
||||
try renderToken(tree, stream, field.name_token, indent, Space.None); // name
|
||||
try renderToken(tree, stream, tree.nextToken(field.name_token), indent, Space.Space); // :
|
||||
try renderExpression(allocator, stream, tree, indent, field.type_expr, Space.None); // type
|
||||
try renderToken(tree, stream, tree.nextToken(field.lastToken()), indent, Space.Newline); // ,
|
||||
try renderTrailingComma(allocator, stream, tree, indent, field.type_expr, Space.Newline); // type,
|
||||
},
|
||||
|
||||
ast.Node.Id.UnionTag => {
|
||||
|
|
Loading…
Reference in New Issue