authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-31 15:48:08 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-31 15:48:08 -07:00
log72fb20a7c5f6f466ced5c3bc731864ee69bc7682
treea966ef94d8253e145e362cb28de42db05ed38234
parent93e7414f96aa2b27f3f0bf72f27967c83e6396ef
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

fmt: add some returns to not trigger the error added in 1a90f8f77b3e01150399d0fca057bc8e109bf7e2


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

fmt.zig+5-1
...@@ -495,6 +495,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions,...@@ -495,6 +495,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions,
495 } else {495 } else {
496 try format(writer, "@{x}", .{@intFromPtr(&value)});496 try format(writer, "@{x}", .{@intFromPtr(&value)});
497 }497 }
498 return;
498 },499 },
499 .@"struct" => |info| {500 .@"struct" => |info| {
500 if (actual_fmt.len != 0) invalidFmtError(fmt, value);501 if (actual_fmt.len != 0) invalidFmtError(fmt, value);
...@@ -530,6 +531,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions,...@@ -530,6 +531,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions,
530 try formatType(@field(value, f.name), "any", options, writer, max_depth - 1);531 try formatType(@field(value, f.name), "any", options, writer, max_depth - 1);
531 }532 }
532 try writer.writeAll(" }");533 try writer.writeAll(" }");
534 return;
533 },535 },
534 .pointer => |ptr_info| switch (ptr_info.size) {536 .pointer => |ptr_info| switch (ptr_info.size) {
535 .one => switch (@typeInfo(ptr_info.child)) {537 .one => switch (@typeInfo(ptr_info.child)) {
...@@ -547,7 +549,6 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions,...@@ -547,7 +549,6 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions,
547 if (actual_fmt[0] == 's' and ptr_info.child == u8) {549 if (actual_fmt[0] == 's' and ptr_info.child == u8) {
548 return formatBuf(std.mem.span(value), options, writer);550 return formatBuf(std.mem.span(value), options, writer);
549 }551 }
550 invalidFmtError(fmt, value);
551 },552 },
552 .slice => {553 .slice => {
553 if (actual_fmt.len == 0) {554 if (actual_fmt.len == 0) {
...@@ -567,6 +568,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions,...@@ -567,6 +568,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions,
567 }568 }
568 }569 }
569 try writer.writeAll(" }");570 try writer.writeAll(" }");
571 return;
570 },572 },
571 },573 },
572 .array => |info| {574 .array => |info| {
...@@ -587,6 +589,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions,...@@ -587,6 +589,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions,
587 }589 }
588 }590 }
589 try writer.writeAll(" }");591 try writer.writeAll(" }");
592 return;
590 },593 },
591 .vector => |info| {594 .vector => |info| {
592 if (max_depth == 0) {595 if (max_depth == 0) {
...@@ -601,6 +604,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions,...@@ -601,6 +604,7 @@ fn formatType(value: anytype, comptime fmt: []const u8, options: FormatOptions,
601 }604 }
602 }605 }
603 try writer.writeAll(" }");606 try writer.writeAll(" }");
607 return;
604 },608 },
605 .@"fn" => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"),609 .@"fn" => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"),
606 .type => {610 .type => {