mirror of
https://github.com/ziglang/zig.git
synced 2026-02-17 14:59:14 +00:00
fmt: Use left brace position instead of the right one
Fix a typo and add a test case.
This commit is contained in:
parent
f34abbf260
commit
e548195fd5
@ -7,6 +7,15 @@ test "zig fmt: trailing comma in container declaration" {
|
||||
\\const X = struct { foo: i32 align(4) = 1, bar: i32 align(4) = 2 };
|
||||
\\
|
||||
);
|
||||
try testTransform(
|
||||
\\const X = struct {
|
||||
\\ foo: i32, bar: i8 };
|
||||
,
|
||||
\\const X = struct {
|
||||
\\ foo: i32, bar: i8
|
||||
\\};
|
||||
\\
|
||||
);
|
||||
}
|
||||
|
||||
test "zig fmt: trailing comma in fn parameter list" {
|
||||
|
||||
@ -1181,8 +1181,8 @@ fn renderExpression(
|
||||
|
||||
// Check if the first declaration and the { are on the same line
|
||||
const src_has_newline = !tree.tokensOnSameLine(
|
||||
container_decl.lbrace_token,
|
||||
container_decl.fields_and_decls.at(0).*.firstToken(),
|
||||
container_decl.rbrace_token,
|
||||
);
|
||||
|
||||
// We can only print all the elements in-line if all the
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user