Free State Labs

Zig Notes

Dev Tips ’n Tricks

zig fmt Likes to Make Long Single-Line Expressions

Fix: add a trailing comma.

const MyError: type = error { 
    AllocationFailure, 
    DivideByZero,      // Trailing comma prevents `zig fmt` from making this one line
};

rust-analyzer likes to essentially put a single word on every line, hopefully zig fmt doesn’t do the same…