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(...@@ -537,7 +537,7 @@ pub fn formatType(
537 }537 }
538 try writer.writeAll("{ ");538 try writer.writeAll("{ ");
539 for (value) |elem, i| {539 for (value) |elem, i| {
540 try formatType(elem, fmt, options, writer, max_depth);540 try formatType(elem, fmt, options, writer, max_depth - 1);
541 if (i != value.len - 1) {541 if (i != value.len - 1) {
542 try writer.writeAll(", ");542 try writer.writeAll(", ");
543 }543 }
...@@ -580,7 +580,7 @@ pub fn formatType(...@@ -580,7 +580,7 @@ pub fn formatType(
580 .Type => return formatBuf(@typeName(value), options, writer),580 .Type => return formatBuf(@typeName(value), options, writer),
581 .EnumLiteral => {581 .EnumLiteral => {
582 const buffer = [_]u8{'.'} ++ @tagName(value);582 const buffer = [_]u8{'.'} ++ @tagName(value);
583 return formatType(buffer, fmt, options, writer, max_depth);583 return formatBuf(buffer, options, writer);
584 },584 },
585 .Null => return formatBuf("null", options, writer),585 .Null => return formatBuf("null", options, writer),
586 else => @compileError("Unable to format type '" ++ @typeName(T) ++ "'"),586 else => @compileError("Unable to format type '" ++ @typeName(T) ++ "'"),