diff options
Diffstat (limited to 'src/Messages.zig')
| -rw-r--r-- | src/Messages.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Messages.zig b/src/Messages.zig index ad91cf8d..80e7ab07 100644 --- a/src/Messages.zig +++ b/src/Messages.zig @@ -118,7 +118,7 @@ pub const Message = struct { var text: [8]u8 = "--:--:--".*; if (noTime()) return text; const day: u32 = @intCast(@mod(seconds + gmtoff, 86400)); - _ = std.fmt.bufPrint(&text, "{d:0>2}:{d:0>2}:{d:0>2}", .{ day / 3600, day / 60 % 60, day % 60 }) catch {}; + _ = std.fmt.bufPrint(&text, "{d:0>2}:{d:0>2}:{d:0>2}", .{ day / 3600, day / 60 % 60, day % 60 }) catch unreachable; // under a day: 8 bytes return text; } @@ -435,7 +435,9 @@ pub fn errorWords(err: anyerror, buf: []u8) []const u8 { pub fn zonWhy(diag: *const std.zon.parse.Diagnostics, buf: []u8) []const u8 { if (diag.errors.len == 0) return "not valid ZON"; const first = diag.errors[0]; - return std.fmt.bufPrint(buf, "line {d}: {s}", .{ first.loc.line + 1, first.msg }) catch "not valid ZON"; + var w: std.Io.Writer = .fixed(buf); + w.print("line {d}: {s}", .{ first.loc.line + 1, first.msg }) catch {}; // a long message is cut at the room's end + return w.buffered(); } test "errors are said in words, and a ZON failure names its line" { |
