Skip to content

Commit 83f6f73

Browse files
mikdusanandrewrk
authored andcommitted
std: simplify format enum-literals
1 parent 1ad831a commit 83f6f73

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/std/fmt.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,7 @@ pub fn formatType(
492492
},
493493
.Type => return output(context, @typeName(T)),
494494
.EnumLiteral => {
495-
const name = @tagName(value);
496-
var buffer: [name.len + 1]u8 = undefined;
497-
buffer[0] = '.';
498-
std.mem.copy(u8, buffer[1..], name);
495+
const buffer = [_]u8{'.'} ++ @tagName(value);
499496
return formatType(buffer, fmt, options, context, Errors, output, max_depth);
500497
},
501498
else => @compileError("Unable to format type '" ++ @typeName(T) ++ "'"),

0 commit comments

Comments
 (0)