| ... | @@ -443,13 +443,9 @@ fn formatValue( | ... | @@ -443,13 +443,9 @@ fn formatValue( |
| 443 | output: fn (@typeOf(context), []const u8) Errors!void, | 443 | output: fn (@typeOf(context), []const u8) Errors!void, |
| 444 | ) Errors!void { | 444 | ) Errors!void { |
| 445 | if (comptime std.mem.eql(u8, fmt, "B")) { | 445 | if (comptime std.mem.eql(u8, fmt, "B")) { |
| 446 | // TODO https://github.com/ziglang/zig/issues/2725 | 446 | return formatBytes(value, options.width, 1000, context, Errors, output); |
| 447 | if (options.width) |w| return formatBytes(value, w, 1000, context, Errors, output); | | |
| 448 | return formatBytes(value, null, 1000, context, Errors, output); | | |
| 449 | } else if (comptime std.mem.eql(u8, fmt, "Bi")) { | 447 | } else if (comptime std.mem.eql(u8, fmt, "Bi")) { |
| 450 | // TODO https://github.com/ziglang/zig/issues/2725 | 448 | return formatBytes(value, options.width, 1024, context, Errors, output); |
| 451 | if (options.width) |w| return formatBytes(value, w, 1024, context, Errors, output); | | |
| 452 | return formatBytes(value, null, 1024, context, Errors, output); | | |
| 453 | } | 449 | } |
| 454 | | 450 | |
| 455 | const T = @typeOf(value); | 451 | const T = @typeOf(value); |
| ... | @@ -499,9 +495,7 @@ pub fn formatIntValue( | ... | @@ -499,9 +495,7 @@ pub fn formatIntValue( |
| 499 | @compileError("Unknown format string: '" ++ fmt ++ "'"); | 495 | @compileError("Unknown format string: '" ++ fmt ++ "'"); |
| 500 | } | 496 | } |
| 501 | | 497 | |
| 502 | // TODO https://github.com/ziglang/zig/issues/2725 | 498 | return formatInt(int_value, radix, uppercase, options.width orelse 0, context, Errors, output); |
| 503 | if (options.width) |w| return formatInt(int_value, radix, uppercase, w, context, Errors, output); | | |
| 504 | return formatInt(int_value, radix, uppercase, 0, context, Errors, output); | | |
| 505 | } | 499 | } |
| 506 | | 500 | |
| 507 | fn formatFloatValue( | 501 | fn formatFloatValue( |
| ... | @@ -513,13 +507,9 @@ fn formatFloatValue( | ... | @@ -513,13 +507,9 @@ fn formatFloatValue( |
| 513 | output: fn (@typeOf(context), []const u8) Errors!void, | 507 | output: fn (@typeOf(context), []const u8) Errors!void, |
| 514 | ) Errors!void { | 508 | ) Errors!void { |
| 515 | if (fmt.len == 0 or comptime std.mem.eql(u8, fmt, "e")) { | 509 | if (fmt.len == 0 or comptime std.mem.eql(u8, fmt, "e")) { |
| 516 | // TODO https://github.com/ziglang/zig/issues/2725 | 510 | return formatFloatScientific(value, options.precision, context, Errors, output); |
| 517 | if (options.precision) |p| return formatFloatScientific(value, p, context, Errors, output); | | |
| 518 | return formatFloatScientific(value, null, context, Errors, output); | | |
| 519 | } else if (comptime std.mem.eql(u8, fmt, "d")) { | 511 | } else if (comptime std.mem.eql(u8, fmt, "d")) { |
| 520 | // TODO https://github.com/ziglang/zig/issues/2725 | 512 | return formatFloatDecimal(value, options.precision, context, Errors, output); |
| 521 | if (options.precision) |p| return formatFloatDecimal(value, p, context, Errors, output); | | |
| 522 | return formatFloatDecimal(value, null, context, Errors, output); | | |
| 523 | } else { | 513 | } else { |
| 524 | @compileError("Unknown format string: '" ++ fmt ++ "'"); | 514 | @compileError("Unknown format string: '" ++ fmt ++ "'"); |
| 525 | } | 515 | } |