diff options
Diffstat (limited to 'lib/std/meta/trait.zig')
| -rw-r--r-- | lib/std/meta/trait.zig | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/std/meta/trait.zig b/lib/std/meta/trait.zig index 843ada7f56..36f0a8924d 100644 --- a/lib/std/meta/trait.zig +++ b/lib/std/meta/trait.zig @@ -400,18 +400,18 @@ test "isTuple" { /// *const u8, ?[]const u8, ?*const [N]u8. /// ``` pub fn isZigString(comptime T: type) bool { - comptime { + return comptime blk: { // Only pointer types can be strings, no optionals const info = @typeInfo(T); - if (info != .Pointer) return false; + if (info != .Pointer) break :blk false; const ptr = &info.Pointer; // Check for CV qualifiers that would prevent coerction to []const u8 - if (ptr.is_volatile or ptr.is_allowzero) return false; + if (ptr.is_volatile or ptr.is_allowzero) break :blk false; // If it's already a slice, simple check. if (ptr.size == .Slice) { - return ptr.child == u8; + break :blk ptr.child == u8; } // Otherwise check if it's an array type that coerces to slice. @@ -419,12 +419,12 @@ pub fn isZigString(comptime T: type) bool { const child = @typeInfo(ptr.child); if (child == .Array) { const arr = &child.Array; - return arr.child == u8; + break :blk arr.child == u8; } } - return false; - } + break :blk false; + }; } test "isZigString" { |
