diff options
Diffstat (limited to 'lib/std/Progress.zig')
| -rw-r--r-- | lib/std/Progress.zig | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/std/Progress.zig b/lib/std/Progress.zig index 38a0258649..060ba085b6 100644 --- a/lib/std/Progress.zig +++ b/lib/std/Progress.zig @@ -1248,7 +1248,9 @@ fn computeRedraw(serialized_buffer: *Serialized.Buffer) struct { []u8, usize } { i += progress_pulsing.len; } else { const percent = completed_items * 100 / estimated_total; - i += (std.fmt.bufPrint(buf[i..], @"progress_normal {d}", .{percent}) catch &.{}).len; + if (std.fmt.bufPrint(buf[i..], @"progress_normal {d}", .{percent})) |b| { + i += b.len; + } else |_| {} } }, .success => { @@ -1265,7 +1267,9 @@ fn computeRedraw(serialized_buffer: *Serialized.Buffer) struct { []u8, usize } { i += progress_pulsing_error.len; } else { const percent = completed_items * 100 / estimated_total; - i += (std.fmt.bufPrint(buf[i..], @"progress_error {d}", .{percent}) catch &.{}).len; + if (std.fmt.bufPrint(buf[i..], @"progress_error {d}", .{percent})) |b| { + i += b.len; + } else |_| {} } }, } @@ -1364,12 +1368,18 @@ fn computeNode( if (!is_empty_root) { if (name.len != 0 or estimated_total > 0) { if (estimated_total > 0) { - i += (std.fmt.bufPrint(buf[i..], "[{d}/{d}] ", .{ completed_items, estimated_total }) catch &.{}).len; + if (std.fmt.bufPrint(buf[i..], "[{d}/{d}] ", .{ completed_items, estimated_total })) |b| { + i += b.len; + } else |_| {} } else if (completed_items != 0) { - i += (std.fmt.bufPrint(buf[i..], "[{d}] ", .{completed_items}) catch &.{}).len; + if (std.fmt.bufPrint(buf[i..], "[{d}] ", .{completed_items})) |b| { + i += b.len; + } else |_| {} } if (name.len != 0) { - i += (std.fmt.bufPrint(buf[i..], "{s}", .{name}) catch &.{}).len; + if (std.fmt.bufPrint(buf[i..], "{s}", .{name})) |b| { + i += b.len; + } else |_| {} } } |
