Use switch and not if to format Kind

This commit is contained in:
Jeffrey C. Ollie
2024-08-21 12:37:18 -05:00
parent 571988bf99
commit 54e2ea05a5

View File

@ -56,12 +56,9 @@ pub const Kind = union(enum) {
_ = layout; _ = layout;
_ = opts; _ = opts;
// Format as a number if its a palette color otherwise switch (self) {
// format as a string. .palette => |p| try writer.print("{d}", .{p}),
if (self == .palette) { .special => |s| try writer.print("{s}", .{@tagName(s)}),
try writer.print("{d}", .{self.palette});
} else {
try writer.print("{s}", .{@tagName(self.special)});
} }
} }
}; };