aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-12-02 20:02:51 +0100
committerAndrew Kelley <andrew@ziglang.org>2021-01-02 17:12:57 -0700
commit608a73efb12df43fbc136c4439558f87a063dc31 (patch)
tree98ce9f9878ec2f35047e941e13ee6d001600c222 /lib/std
parent04f37dcd8e9c32d7ce8712939fb9c8dfa6cc6bbe (diff)
downloadzig-608a73efb12df43fbc136c4439558f87a063dc31.tar.gz
zig-608a73efb12df43fbc136c4439558f87a063dc31.zip
Decrement max_depth when printing slice elements
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/fmt.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig
index 54d96168e2..bc9ac92283 100644
--- a/lib/std/fmt.zig
+++ b/lib/std/fmt.zig
@@ -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(", ");
}
@@ -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) ++ "'"),