authorgravatar for marc@tiehu.isMarc Tiehuis <marc@tiehu.is> 2019-06-27 21:50:24+12:00
committergravatar for marc@tiehu.isMarc Tiehuis <marc@tiehu.is> 2019-06-27 21:50:24+12:00
log3c914c63a5bd060fa15cf73985097da779b7403e
treede2cf528d978a735d28f7ebafe6815acb40f5477
parent6c195ede54fe9f75c794204fb39c915a9e5581ed

Remove #2725 workaround

These were no longer being hit after the copy-elision branch was merged. Closes #2725.

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

std/fmt.zig+5-15
......@@ -443,13 +443,9 @@ fn formatValue(
443443 output: fn (@typeOf(context), []const u8) Errors!void,
444444) Errors!void {
445445 if (comptime std.mem.eql(u8, fmt, "B")) {
446 // TODO https://github.com/ziglang/zig/issues/2725
447 if (options.width) |w| return formatBytes(value, w, 1000, context, Errors, output);
448 return formatBytes(value, null, 1000, context, Errors, output);
446 return formatBytes(value, options.width, 1000, context, Errors, output);
449447 } else if (comptime std.mem.eql(u8, fmt, "Bi")) {
450 // TODO https://github.com/ziglang/zig/issues/2725
451 if (options.width) |w| return formatBytes(value, w, 1024, context, Errors, output);
452 return formatBytes(value, null, 1024, context, Errors, output);
448 return formatBytes(value, options.width, 1024, context, Errors, output);
453449 }
454450
455451 const T = @typeOf(value);
......@@ -499,9 +495,7 @@ pub fn formatIntValue(
499495 @compileError("Unknown format string: '" ++ fmt ++ "'");
500496 }
501497
502 // TODO https://github.com/ziglang/zig/issues/2725
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);
498 return formatInt(int_value, radix, uppercase, options.width orelse 0, context, Errors, output);
505499}
506500
507501fn formatFloatValue(
......@@ -513,13 +507,9 @@ fn formatFloatValue(
513507 output: fn (@typeOf(context), []const u8) Errors!void,
514508) Errors!void {
515509 if (fmt.len == 0 or comptime std.mem.eql(u8, fmt, "e")) {
516 // TODO https://github.com/ziglang/zig/issues/2725
517 if (options.precision) |p| return formatFloatScientific(value, p, context, Errors, output);
518 return formatFloatScientific(value, null, context, Errors, output);
510 return formatFloatScientific(value, options.precision, context, Errors, output);
519511 } else if (comptime std.mem.eql(u8, fmt, "d")) {
520 // TODO https://github.com/ziglang/zig/issues/2725
521 if (options.precision) |p| return formatFloatDecimal(value, p, context, Errors, output);
522 return formatFloatDecimal(value, null, context, Errors, output);
512 return formatFloatDecimal(value, options.precision, context, Errors, output);
523513 } else {
524514 @compileError("Unknown format string: '" ++ fmt ++ "'");
525515 }