| ... | ... | @@ -83,7 +83,7 @@ pub fn format( |
| 83 | 83 | const ArgsType = @TypeOf(args); |
| 84 | 84 | const args_type_info = @typeInfo(ArgsType); |
| 85 | 85 | if (args_type_info != .Struct) { |
| 86 | | @compileError("Expected tuple or struct argument, found " ++ @typeName(ArgsType)); |
| 86 | @compileError("expected tuple or struct argument, found " ++ @typeName(ArgsType)); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | const fields_info = args_type_info.Struct.fields; |
| ... | ... | @@ -127,7 +127,7 @@ pub fn format( |
| 127 | 127 | if (i >= fmt.len) break; |
| 128 | 128 | |
| 129 | 129 | if (fmt[i] == '}') { |
| 130 | | @compileError("Missing opening {"); |
| 130 | @compileError("missing opening {"); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | // Get past the { |
| ... | ... | @@ -140,7 +140,7 @@ pub fn format( |
| 140 | 140 | const fmt_end = i; |
| 141 | 141 | |
| 142 | 142 | if (i >= fmt.len) { |
| 143 | | @compileError("Missing closing }"); |
| 143 | @compileError("missing closing }"); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // Get past the } |
| ... | ... | @@ -152,7 +152,7 @@ pub fn format( |
| 152 | 152 | .none => null, |
| 153 | 153 | .number => |pos| pos, |
| 154 | 154 | .named => |arg_name| meta.fieldIndex(ArgsType, arg_name) orelse |
| 155 | | @compileError("No argument with name '" ++ arg_name ++ "'"), |
| 155 | @compileError("no argument with name '" ++ arg_name ++ "'"), |
| 156 | 156 | }; |
| 157 | 157 | |
| 158 | 158 | const width = switch (placeholder.width) { |
| ... | ... | @@ -160,8 +160,8 @@ pub fn format( |
| 160 | 160 | .number => |v| v, |
| 161 | 161 | .named => |arg_name| blk: { |
| 162 | 162 | const arg_i = comptime meta.fieldIndex(ArgsType, arg_name) orelse |
| 163 | | @compileError("No argument with name '" ++ arg_name ++ "'"); |
| 164 | | _ = comptime arg_state.nextArg(arg_i) orelse @compileError("Too few arguments"); |
| 163 | @compileError("no argument with name '" ++ arg_name ++ "'"); |
| 164 | _ = comptime arg_state.nextArg(arg_i) orelse @compileError("too few arguments"); |
| 165 | 165 | break :blk @field(args, arg_name); |
| 166 | 166 | }, |
| 167 | 167 | }; |
| ... | ... | @@ -171,14 +171,14 @@ pub fn format( |
| 171 | 171 | .number => |v| v, |
| 172 | 172 | .named => |arg_name| blk: { |
| 173 | 173 | const arg_i = comptime meta.fieldIndex(ArgsType, arg_name) orelse |
| 174 | | @compileError("No argument with name '" ++ arg_name ++ "'"); |
| 175 | | _ = comptime arg_state.nextArg(arg_i) orelse @compileError("Too few arguments"); |
| 174 | @compileError("no argument with name '" ++ arg_name ++ "'"); |
| 175 | _ = comptime arg_state.nextArg(arg_i) orelse @compileError("too few arguments"); |
| 176 | 176 | break :blk @field(args, arg_name); |
| 177 | 177 | }, |
| 178 | 178 | }; |
| 179 | 179 | |
| 180 | 180 | const arg_to_print = comptime arg_state.nextArg(arg_pos) orelse |
| 181 | | @compileError("Too few arguments"); |
| 181 | @compileError("too few arguments"); |
| 182 | 182 | |
| 183 | 183 | try formatType( |
| 184 | 184 | @field(args, fields_info[arg_to_print].name), |
| ... | ... | @@ -198,7 +198,7 @@ pub fn format( |
| 198 | 198 | const missing_count = arg_state.args_len - @popCount(ArgSetType, arg_state.used_args); |
| 199 | 199 | switch (missing_count) { |
| 200 | 200 | 0 => unreachable, |
| 201 | | 1 => @compileError("Unused argument in '" ++ fmt ++ "'"), |
| 201 | 1 => @compileError("unused argument in '" ++ fmt ++ "'"), |
| 202 | 202 | else => @compileError((comptime comptimePrint("{d}", .{missing_count})) ++ " unused arguments in '" ++ fmt ++ "'"), |
| 203 | 203 | } |
| 204 | 204 | } |
| ... | ... | @@ -217,7 +217,7 @@ fn parsePlaceholder(comptime str: anytype) Placeholder { |
| 217 | 217 | // Skip the colon, if present |
| 218 | 218 | if (comptime parser.char()) |ch| { |
| 219 | 219 | if (ch != ':') { |
| 220 | | @compileError("Expected : or }, found '" ++ [1]u8{ch} ++ "'"); |
| 220 | @compileError("expected : or }, found '" ++ [1]u8{ch} ++ "'"); |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
| ... | ... | @@ -252,7 +252,7 @@ fn parsePlaceholder(comptime str: anytype) Placeholder { |
| 252 | 252 | // Skip the dot, if present |
| 253 | 253 | if (comptime parser.char()) |ch| { |
| 254 | 254 | if (ch != '.') { |
| 255 | | @compileError("Expected . or }, found '" ++ [1]u8{ch} ++ "'"); |
| 255 | @compileError("expected . or }, found '" ++ [1]u8{ch} ++ "'"); |
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
| ... | ... | @@ -261,7 +261,7 @@ fn parsePlaceholder(comptime str: anytype) Placeholder { |
| 261 | 261 | @compileError(@errorName(err)); |
| 262 | 262 | |
| 263 | 263 | if (comptime parser.char()) |ch| { |
| 264 | | @compileError("Extraneous trailing character '" ++ [1]u8{ch} ++ "'"); |
| 264 | @compileError("extraneous trailing character '" ++ [1]u8{ch} ++ "'"); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | return Placeholder{ |
| ... | ... | @@ -423,7 +423,7 @@ pub fn formatAddress(value: anytype, options: FormatOptions, writer: anytype) @T |
| 423 | 423 | else => {}, |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | | @compileError("Cannot format non-pointer type " ++ @typeName(T) ++ " with * specifier"); |
| 426 | @compileError("cannot format non-pointer type " ++ @typeName(T) ++ " with * specifier"); |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | // This ANY const is a workaround for: https://github.com/ziglang/zig/issues/7948 |
| ... | ... | @@ -608,7 +608,7 @@ pub fn formatType( |
| 608 | 608 | } |
| 609 | 609 | return; |
| 610 | 610 | } |
| 611 | | @compileError("Unknown format string: '" ++ actual_fmt ++ "' for type '" ++ @typeName(T) ++ "'"); |
| 611 | @compileError("unknown format string: '" ++ actual_fmt ++ "' for type '" ++ @typeName(T) ++ "'"); |
| 612 | 612 | }, |
| 613 | 613 | .Enum, .Union, .Struct => { |
| 614 | 614 | return formatType(value.*, actual_fmt, options, writer, max_depth); |
| ... | ... | @@ -630,7 +630,7 @@ pub fn formatType( |
| 630 | 630 | else => {}, |
| 631 | 631 | } |
| 632 | 632 | } |
| 633 | | @compileError("Unknown format string: '" ++ actual_fmt ++ "' for type '" ++ @typeName(T) ++ "'"); |
| 633 | @compileError("unknown format string: '" ++ actual_fmt ++ "' for type '" ++ @typeName(T) ++ "'"); |
| 634 | 634 | }, |
| 635 | 635 | .Slice => { |
| 636 | 636 | if (actual_fmt.len == 0) |
| ... | ... | @@ -701,7 +701,7 @@ pub fn formatType( |
| 701 | 701 | return formatBuf(buffer, options, writer); |
| 702 | 702 | }, |
| 703 | 703 | .Null => return formatBuf("null", options, writer), |
| 704 | | else => @compileError("Unable to format type '" ++ @typeName(T) ++ "'"), |
| 704 | else => @compileError("unable to format type '" ++ @typeName(T) ++ "'"), |
| 705 | 705 | } |
| 706 | 706 | } |
| 707 | 707 | |
| ... | ... | @@ -747,13 +747,13 @@ pub fn formatIntValue( |
| 747 | 747 | if (@typeInfo(@TypeOf(int_value)).Int.bits <= 8) { |
| 748 | 748 | return formatAsciiChar(@as(u8, int_value), options, writer); |
| 749 | 749 | } else { |
| 750 | | @compileError("Cannot print integer that is larger than 8 bits as an ASCII character"); |
| 750 | @compileError("cannot print integer that is larger than 8 bits as an ASCII character"); |
| 751 | 751 | } |
| 752 | 752 | } else if (comptime std.mem.eql(u8, fmt, "u")) { |
| 753 | 753 | if (@typeInfo(@TypeOf(int_value)).Int.bits <= 21) { |
| 754 | 754 | return formatUnicodeCodepoint(@as(u21, int_value), options, writer); |
| 755 | 755 | } else { |
| 756 | | @compileError("Cannot print integer that is larger than 21 bits as an UTF-8 sequence"); |
| 756 | @compileError("cannot print integer that is larger than 21 bits as an UTF-8 sequence"); |
| 757 | 757 | } |
| 758 | 758 | } else if (comptime std.mem.eql(u8, fmt, "b")) { |
| 759 | 759 | radix = 2; |
| ... | ... | @@ -768,7 +768,7 @@ pub fn formatIntValue( |
| 768 | 768 | radix = 8; |
| 769 | 769 | case = .lower; |
| 770 | 770 | } else { |
| 771 | | @compileError("Unsupported format string '" ++ fmt ++ "' for type '" ++ @typeName(@TypeOf(value)) ++ "'"); |
| 771 | @compileError("unsupported format string '" ++ fmt ++ "' for type '" ++ @typeName(@TypeOf(value)) ++ "'"); |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | return formatInt(int_value, radix, case, options, writer); |
| ... | ... | @@ -797,7 +797,7 @@ fn formatFloatValue( |
| 797 | 797 | error.NoSpaceLeft => unreachable, |
| 798 | 798 | }; |
| 799 | 799 | } else { |
| 800 | | @compileError("Unsupported format string '" ++ fmt ++ "' for type '" ++ @typeName(@TypeOf(value)) ++ "'"); |
| 800 | @compileError("unsupported format string '" ++ fmt ++ "' for type '" ++ @typeName(@TypeOf(value)) ++ "'"); |
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | return formatBuf(buf_stream.getWritten(), options, writer); |
| ... | ... | @@ -959,7 +959,7 @@ pub fn fmtIntSizeBin(value: u64) std.fmt.Formatter(formatSizeBin) { |
| 959 | 959 | |
| 960 | 960 | fn checkTextFmt(comptime fmt: []const u8) void { |
| 961 | 961 | if (fmt.len != 1) |
| 962 | | @compileError("Unsupported format string '" ++ fmt ++ "' when formatting text"); |
| 962 | @compileError("unsupported format string '" ++ fmt ++ "' when formatting text"); |
| 963 | 963 | switch (fmt[0]) { |
| 964 | 964 | 'x' => @compileError("specifier 'x' has been deprecated, wrap your argument in std.fmt.fmtSliceHexLower instead"), |
| 965 | 965 | 'X' => @compileError("specifier 'X' has been deprecated, wrap your argument in std.fmt.fmtSliceHexUpper instead"), |
| ... | ... | @@ -2377,7 +2377,7 @@ test "custom" { |
| 2377 | 2377 | } else if (comptime std.mem.eql(u8, fmt, "d")) { |
| 2378 | 2378 | return std.fmt.format(writer, "{d:.3}x{d:.3}", .{ self.x, self.y }); |
| 2379 | 2379 | } else { |
| 2380 | | @compileError("Unknown format character: '" ++ fmt ++ "'"); |
| 2380 | @compileError("unknown format character: '" ++ fmt ++ "'"); |
| 2381 | 2381 | } |
| 2382 | 2382 | } |
| 2383 | 2383 | }; |
| ... | ... | @@ -2585,7 +2585,7 @@ test "formatType max_depth" { |
| 2585 | 2585 | if (fmt.len == 0) { |
| 2586 | 2586 | return std.fmt.format(writer, "({d:.3},{d:.3})", .{ self.x, self.y }); |
| 2587 | 2587 | } else { |
| 2588 | | @compileError("Unknown format string: '" ++ fmt ++ "'"); |
| 2588 | @compileError("unknown format string: '" ++ fmt ++ "'"); |
| 2589 | 2589 | } |
| 2590 | 2590 | } |
| 2591 | 2591 | }; |