8cd8ccd38f1fb61153a52683ed11e558a143c41c — Greg Anders 8 months ago d90492f
Remove unreachable statements when using stdout

Unreachable statements cause UB when used in unsafe build modes, so they
should only be used in cases that are *actually* unreachable.
Considering there are realistic cases where stdout could fail, this is
not a good use of unreachable, so instead just prematurely exit the
1 files changed, 4 insertions(+), 4 deletions(-)

M src/main.zig
M src/main.zig => src/main.zig +4 -4
@@ 5,11 5,11 @@ const stderr = std.io.getStdErr().outStream();
const cmd = @import("cmd.zig");

fn printUsage(exe: []const u8) void {
    stdout.print("Usage: {} COMMAND\n", .{std.fs.path.basename(exe)}) catch unreachable;
    stdout.print("\n", .{}) catch unreachable;
    stdout.print("Available commands:\n", .{}) catch unreachable;
    stdout.print("Usage: {} COMMAND\n", .{std.fs.path.basename(exe)}) catch return;
    stdout.print("\n", .{}) catch return;
    stdout.print("Available commands:\n", .{}) catch return;
    inline for (@typeInfo(cmd.Command).Enum.fields) |command| {
        stdout.print("\t{}\n", .{@field(cmd.Command, command.name).usage()}) catch unreachable;
        stdout.print("\t{}\n", .{@field(cmd.Command, command.name).usage()}) catch return;