From 159e4397fccf89af919d351945edb09af6a73165 Mon Sep 17 00:00:00 2001 From: whatisaphone Date: Fri, 24 Jul 2026 16:25:08 -0400 Subject: [PATCH 1/2] Remove redundant case --- lib/std/zig.zig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/std/zig.zig b/lib/std/zig.zig index 4c41d56845f7ebd32bb83a51d2ec182b7e4e7154..0b798195f4f160013df7da9d76d6f2e3ea20499e 100644 --- a/lib/std/zig.zig +++ b/lib/std/zig.zig @@ -545,8 +545,7 @@ pub fn stringEscape(bytes: []const u8, w: *Writer) Writer.Error!void { '\t' => try w.writeAll("\\t"), '\\' => try w.writeAll("\\\\"), '"' => try w.writeAll("\\\""), - '\'' => try w.writeByte('\''), - ' ', '!', '#'...'&', '('...'[', ']'...'~' => try w.writeByte(byte), + ' ', '!', '#'...'[', ']'...'~' => try w.writeByte(byte), else => { try w.writeAll("\\x"); try w.printInt(byte, 16, .lower, .{ .width = 2, .fill = '0' }); -- 2.54.0 From f6366f65bcff9405e11aeb6b876211f33c0076a4 Mon Sep 17 00:00:00 2001 From: whatisaphone Date: Fri, 24 Jul 2026 16:38:48 -0400 Subject: [PATCH 2/2] Simplify return type of hexEscape --- lib/std/ascii.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/std/ascii.zig b/lib/std/ascii.zig index e346e87eb6805c0328d909a1709223c628db5858..90fce8cb531c90659dccabb235b00c46e06bdfa1 100644 --- a/lib/std/ascii.zig +++ b/lib/std/ascii.zig @@ -511,11 +511,11 @@ pub const HexEscape = struct { }; /// Replaces non-ASCII bytes with hex escapes. -pub fn hexEscape(bytes: []const u8, case: std.fmt.Case) std.fmt.Alt(HexEscape, HexEscape.format) { - return .{ .data = .{ .bytes = bytes, .charset = switch (case) { +pub fn hexEscape(bytes: []const u8, case: std.fmt.Case) HexEscape { + return .{ .bytes = bytes, .charset = switch (case) { .lower => HexEscape.lower_charset, .upper => HexEscape.upper_charset, - } } }; + } }; } test hexEscape { -- 2.54.0