5 ms·
Very clean, tasteful formatting. Easy to read. There's even correct splitting of long argument lists over multiple lines: [1], [2]. You don't see that very ofte
by Mawr 5y ago
Very clean, tasteful formatting. Easy to read. There's even correct splitting of long argument lists over multiple lines: [1], [2]. You don't see that very often, most programmers have awful taste about this.
I have some qualms with these one-line early returns though:
if (commit <= self.commit_min) return;
Control flow statements should always be on their own lines, then it's easy to find all of them by visually scanning top-down, without needing to look all the way down each line.
[1]: https://github.com/coilhq/tigerbeetle/blob/main/src/vsr/replica.zig#L202 https://github.com/coilhq/tigerbeetle/blob/main/src/vsr/repl...
[2]: https://github.com/coilhq/tigerbeetle/blob/main/src/vsr/replica.zig#L268 https://github.com/coilhq/tigerbeetle/blob/main/src/vsr/repl...
- mbrock 5y agoZig's code formatter puts list items on separate lines if the last item has a trailing comma; otherwise, it puts them all on the same line. So if you use the code formatter, you'll either have just one line, or one line per item. It's pretty nice.