use constant in formatType

This commit is contained in:
orvit 2024-05-21 09:41:49 -05:00 committed by GitHub
parent aa07366513
commit ae44e199a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -480,7 +480,7 @@ pub fn formatType(
) @TypeOf(writer).Error!void {
const T = @TypeOf(value);
const actual_fmt = comptime if (std.mem.eql(u8, fmt, ANY))
defaultSpec(@TypeOf(value))
defaultSpec(T)
else if (fmt.len != 0 and (fmt[0] == '?' or fmt[0] == '!')) switch (@typeInfo(T)) {
.Optional, .ErrorUnion => fmt,
else => stripOptionalOrErrorUnionSpec(fmt),