std.log: deduplicate switch

This commit is contained in:
r00ster91 2022-07-06 19:27:47 +02:00 committed by Veikka Tuominen
parent f1da93af3c
commit 13d58258a8

View File

@ -85,12 +85,7 @@ pub const Level = enum {
debug,
/// Returns a string literal of the given level in full text form.
pub fn asText(comptime self: Level) switch (self) {
.err => @TypeOf("error"),
.warn => @TypeOf("warning"),
.info => @TypeOf("info"),
.debug => @TypeOf("debug"),
} {
pub fn asText(comptime self: Level) []const u8 {
return switch (self) {
.err => "error",
.warn => "warning",