Skip to content

Commit

Permalink
Decrement max_depth when printing slice elements
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonBoy authored and andrewrk committed Jan 3, 2021
1 parent 04f37dc commit 608a73e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/std/fmt.zig
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ pub fn formatType(
}
try writer.writeAll("{ ");
for (value) |elem, i| {
try formatType(elem, fmt, options, writer, max_depth);
try formatType(elem, fmt, options, writer, max_depth - 1);
if (i != value.len - 1) {
try writer.writeAll(", ");
}
Expand Down Expand Up @@ -580,7 +580,7 @@ pub fn formatType(
.Type => return formatBuf(@typeName(value), options, writer),
.EnumLiteral => {
const buffer = [_]u8{'.'} ++ @tagName(value);
return formatType(buffer, fmt, options, writer, max_depth);
return formatBuf(buffer, options, writer);
},
.Null => return formatBuf("null", options, writer),
else => @compileError("Unable to format type '" ++ @typeName(T) ++ "'"),
Expand Down

0 comments on commit 608a73e

Please sign in to comment.