commit 83f6f730cdd5bb9c2a12b30c0aac33d858a1eaa8 (tree)
parent 1ad831a0ef22f354d4e1dd5073456a0683249846
Author: Michael Dusan <michael.dusan@gmail.com>
Date: Tue, 10 Mar 2020 15:22:29 -0400
std: simplify format enum-literals
Diffstat:
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig
@@ -492,10 +492,7 @@ pub fn formatType(
},
.Type => return output(context, @typeName(T)),
.EnumLiteral => {
- const name = @tagName(value);
- var buffer: [name.len + 1]u8 = undefined;
- buffer[0] = '.';
- std.mem.copy(u8, buffer[1..], name);
+ const buffer = [_]u8{'.'} ++ @tagName(value);
return formatType(buffer, fmt, options, context, Errors, output, max_depth);
},
else => @compileError("Unable to format type '" ++ @typeName(T) ++ "'"),