std: fmt.format to io.Writer.print

allows reverting format -> deprecatedFormat, plus I think this is a
nicer place for the function.
This commit is contained in:
Andrew Kelley
2025-07-09 15:31:02 -07:00
parent 4d93545ded
commit 93ac76594a
9 changed files with 215 additions and 219 deletions

View File

@@ -689,7 +689,7 @@ fn outputUnicodeEscape(codepoint: u21, out_stream: anytype) !void {
// by the lowercase letter u, followed by four hexadecimal digits that encode the character's code point.
try out_stream.writeAll("\\u");
//try w.printInt("x", .{ .width = 4, .fill = '0' }, codepoint);
try std.fmt.deprecatedFormat(out_stream, "{x:0>4}", .{codepoint});
try std.fmt.format(out_stream, "{x:0>4}", .{codepoint});
} else {
assert(codepoint <= 0x10FFFF);
// To escape an extended character that is not in the Basic Multilingual Plane,
@@ -698,10 +698,10 @@ fn outputUnicodeEscape(codepoint: u21, out_stream: anytype) !void {
const low = @as(u16, @intCast(codepoint & 0x3FF)) + 0xDC00;
try out_stream.writeAll("\\u");
//try w.printInt("x", .{ .width = 4, .fill = '0' }, high);
try std.fmt.deprecatedFormat(out_stream, "{x:0>4}", .{high});
try std.fmt.format(out_stream, "{x:0>4}", .{high});
try out_stream.writeAll("\\u");
//try w.printInt("x", .{ .width = 4, .fill = '0' }, low);
try std.fmt.deprecatedFormat(out_stream, "{x:0>4}", .{low});
try std.fmt.format(out_stream, "{x:0>4}", .{low});
}
}