Example:
const exit_code: u8 = switch (state) { .success => 0, .failure => 1 };
In short examples like these I don't see the need to split it up into 4 lines like zig fmt would:
const exit_code: u8 = switch (state) {
.success => 0,
.failure => 1,
};
So the proposal is: let me define the formatting by putting or omitting the trailing comma after the last prong.
This behavior would also simply be more consistent with this behavior already existing with arrays, vectors, enums, structs, unions, function calls, function parameters, and maybe more.
Perhaps this is the only case like this with a list of things where the trailing comma is not respected.
Example:
In short examples like these I don't see the need to split it up into 4 lines like
zig fmtwould:So the proposal is: let me define the formatting by putting or omitting the trailing comma after the last prong.
This behavior would also simply be more consistent with this behavior already existing with arrays, vectors, enums, structs, unions, function calls, function parameters, and maybe more.
Perhaps this is the only case like this with a list of things where the trailing comma is not respected.