mirror of
https://github.com/ziglang/zig.git
synced 2025-12-23 14:43:17 +00:00
std: Disable the special casing of {} for u8 slices/arrays
Unless {s} is specified the contents won't be treated as a string.
This commit is contained in:
parent
4420afe64d
commit
1ca2deca33
@ -504,8 +504,10 @@ pub fn formatType(
|
||||
.One => switch (@typeInfo(ptr_info.child)) {
|
||||
.Array => |info| {
|
||||
if (info.child == u8) {
|
||||
if (fmt.len > 0 and comptime mem.indexOfScalar(u8, "sxXeEzZ", fmt[0]) != null) {
|
||||
return formatText(value, fmt, options, writer);
|
||||
}
|
||||
}
|
||||
return format(writer, "{s}@{x}", .{ @typeName(ptr_info.child), @ptrToInt(value) });
|
||||
},
|
||||
.Enum, .Union, .Struct => {
|
||||
@ -529,7 +531,7 @@ pub fn formatType(
|
||||
return writer.writeAll("{ ... }");
|
||||
}
|
||||
if (ptr_info.child == u8) {
|
||||
if (fmt.len == 0 or comptime mem.indexOfScalar(u8, "sxXeEzZ", fmt[0]) != null) {
|
||||
if (fmt.len > 0 and comptime mem.indexOfScalar(u8, "sxXeEzZ", fmt[0]) != null) {
|
||||
return formatText(value, fmt, options, writer);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user