authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-12-02 20:02:51+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-01-02 17:12:57-07:00
log608a73efb12df43fbc136c4439558f87a063dc31
tree98ce9f9878ec2f35047e941e13ee6d001600c222
parent04f37dcd8e9c32d7ce8712939fb9c8dfa6cc6bbe

Decrement max_depth when printing slice elements


1 files changed, 2 insertions(+), 2 deletions(-)

lib/std/fmt.zig+2-2
......@@ -537,7 +537,7 @@ pub fn formatType(
537537 }
538538 try writer.writeAll("{ ");
539539 for (value) |elem, i| {
540 try formatType(elem, fmt, options, writer, max_depth);
540 try formatType(elem, fmt, options, writer, max_depth - 1);
541541 if (i != value.len - 1) {
542542 try writer.writeAll(", ");
543543 }
......@@ -580,7 +580,7 @@ pub fn formatType(
580580 .Type => return formatBuf(@typeName(value), options, writer),
581581 .EnumLiteral => {
582582 const buffer = [_]u8{'.'} ++ @tagName(value);
583 return formatType(buffer, fmt, options, writer, max_depth);
583 return formatBuf(buffer, options, writer);
584584 },
585585 .Null => return formatBuf("null", options, writer),
586586 else => @compileError("Unable to format type '" ++ @typeName(T) ++ "'"),