std.fmt: fully remove format string from format methods
Introduces `std.fmt.alt` which is a helper for calling alternate format methods besides one named "format".
This commit is contained in:
@@ -2471,8 +2471,7 @@ const RenderCTypeTrailing = enum {
|
||||
no_space,
|
||||
maybe_space,
|
||||
|
||||
pub fn format(self: @This(), w: *Writer, comptime fmt: []const u8) Writer.Error!void {
|
||||
comptime assert(fmt.len == 0);
|
||||
pub fn format(self: @This(), w: *Writer) Writer.Error!void {
|
||||
switch (self) {
|
||||
.no_space => {},
|
||||
.maybe_space => try w.writeByte(' '),
|
||||
|
||||
@@ -19,8 +19,7 @@ pub const IdResult = enum(Word) {
|
||||
none,
|
||||
_,
|
||||
|
||||
pub fn format(self: IdResult, writer: *std.io.Writer, comptime f: []const u8) std.io.Writer.Error!void {
|
||||
comptime assert(f.len == 0);
|
||||
pub fn format(self: IdResult, writer: *std.io.Writer) std.io.Writer.Error!void {
|
||||
switch (self) {
|
||||
.none => try writer.writeAll("(none)"),
|
||||
else => try writer.print("%{d}", .{@intFromEnum(self)}),
|
||||
|
||||
Reference in New Issue
Block a user