Skip to content

Commit

Permalink
use constant in formatType
Browse files Browse the repository at this point in the history
  • Loading branch information
orvit authored May 21, 2024
1 parent aa07366 commit ae44e19
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/std/fmt.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit ae44e19

Please sign in to comment.