commit 3c914c63a5bd060fa15cf73985097da779b7403e (tree)
parent 6c195ede54fe9f75c794204fb39c915a9e5581ed
Author: Marc Tiehuis <marc@tiehu.is>
Date: Thu, 27 Jun 2019 21:50:24 +1200
Remove #2725 workaround
These were no longer being hit after the copy-elision branch was merged.
Closes #2725.
Diffstat:
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/std/fmt.zig b/std/fmt.zig
@@ -443,13 +443,9 @@ fn formatValue(
output: fn (@typeOf(context), []const u8) Errors!void,
) Errors!void {
if (comptime std.mem.eql(u8, fmt, "B")) {
- // TODO https://github.com/ziglang/zig/issues/2725
- if (options.width) |w| return formatBytes(value, w, 1000, context, Errors, output);
- return formatBytes(value, null, 1000, context, Errors, output);
+ return formatBytes(value, options.width, 1000, context, Errors, output);
} else if (comptime std.mem.eql(u8, fmt, "Bi")) {
- // TODO https://github.com/ziglang/zig/issues/2725
- if (options.width) |w| return formatBytes(value, w, 1024, context, Errors, output);
- return formatBytes(value, null, 1024, context, Errors, output);
+ return formatBytes(value, options.width, 1024, context, Errors, output);
}
const T = @typeOf(value);
@@ -499,9 +495,7 @@ pub fn formatIntValue(
@compileError("Unknown format string: '" ++ fmt ++ "'");
}
- // TODO https://github.com/ziglang/zig/issues/2725
- if (options.width) |w| return formatInt(int_value, radix, uppercase, w, context, Errors, output);
- return formatInt(int_value, radix, uppercase, 0, context, Errors, output);
+ return formatInt(int_value, radix, uppercase, options.width orelse 0, context, Errors, output);
}
fn formatFloatValue(
@@ -513,13 +507,9 @@ fn formatFloatValue(
output: fn (@typeOf(context), []const u8) Errors!void,
) Errors!void {
if (fmt.len == 0 or comptime std.mem.eql(u8, fmt, "e")) {
- // TODO https://github.com/ziglang/zig/issues/2725
- if (options.precision) |p| return formatFloatScientific(value, p, context, Errors, output);
- return formatFloatScientific(value, null, context, Errors, output);
+ return formatFloatScientific(value, options.precision, context, Errors, output);
} else if (comptime std.mem.eql(u8, fmt, "d")) {
- // TODO https://github.com/ziglang/zig/issues/2725
- if (options.precision) |p| return formatFloatDecimal(value, p, context, Errors, output);
- return formatFloatDecimal(value, null, context, Errors, output);
+ return formatFloatDecimal(value, options.precision, context, Errors, output);
} else {
@compileError("Unknown format string: '" ++ fmt ++ "'");
}