diff --git a/src/fd.zig b/src/fd.zig index d8b92cfe68..acceaaf7e6 100644 --- a/src/fd.zig +++ b/src/fd.zig @@ -303,10 +303,6 @@ pub const FDImpl = packed struct { } pub fn format(this: FDImpl, comptime fmt: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void { - if (fmt.len != 0) { - @compileError("invalid format string for FDImpl.format. must be either '' or 'd'"); - } - if (!this.isValid()) { try writer.writeAll("[invalid_fd]"); return; @@ -317,6 +313,10 @@ pub const FDImpl = packed struct { return; } + if (fmt.len != 0) { + @compileError("invalid format string for FDImpl.format. must be either '' or 'd'"); + } + switch (env.os) { else => { const fd = this.system();