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 { diff --git a/lib/std/zig.zig b/lib/std/zig.zig index 858fb169439c2cdffa31f200e650e7151a2da991..3a456af0ca2a16978dd405886ecbeac1b273d609 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' });