diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-07-08 17:33:02 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-07-09 09:32:07 -0700 |
| commit | bc2cf0c173465f4e3ac60fe2907dfedd2eebf8eb (patch) | |
| tree | 7a404dc11967aa7d552f9fd727477257dd49ad03 /lib/std/fmt.zig | |
| parent | d345a10054caa78d6e697089b0b3ca5b540b2d9c (diff) | |
| download | zig-bc2cf0c173465f4e3ac60fe2907dfedd2eebf8eb.tar.gz zig-bc2cf0c173465f4e3ac60fe2907dfedd2eebf8eb.zip | |
eliminate all uses of std.io.Writer.count except for CBE
Diffstat (limited to 'lib/std/fmt.zig')
| -rw-r--r-- | lib/std/fmt.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index 56780c8593..aa6b5c1670 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -772,11 +772,11 @@ pub fn bufPrintZ(buf: []u8, comptime fmt: []const u8, args: anytype) BufPrintErr /// Count the characters needed for format. pub fn count(comptime fmt: []const u8, args: anytype) usize { var trash_buffer: [64]u8 = undefined; - var w: Writer = .discarding(&trash_buffer); - w.print(fmt, args) catch |err| switch (err) { + var dw: Writer.Discarding = .init(&trash_buffer); + dw.writer.print(fmt, args) catch |err| switch (err) { error.WriteFailed => unreachable, }; - return w.count; + return @intCast(dw.count + dw.writer.end); } pub fn allocPrint(gpa: Allocator, comptime fmt: []const u8, args: anytype) Allocator.Error![]u8 { |
