From 7860cd734ce1227b3e96e4829de8929d546f78e8 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 20 May 2023 22:18:25 +0100 Subject: [PATCH] std.fmt: Rename Alignment enum values to snake case --- lib/std/fmt.zig | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index 38a7975ffd..7ac8ebf6fd 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -14,15 +14,15 @@ const expectFmt = std.testing.expectFmt; pub const default_max_depth = 3; pub const Alignment = enum { - Left, - Center, - Right, + left, + center, + right, }; pub const FormatOptions = struct { precision: ?usize = null, width: ?usize = null, - alignment: Alignment = .Right, + alignment: Alignment = .right, fill: u8 = ' ', }; @@ -252,11 +252,11 @@ pub const Placeholder = struct { else => {}, } break :init switch (ch) { - '<' => .Left, - '^' => .Center, - else => .Right, + '<' => .left, + '^' => .center, + else => .right, }; - } else .Right; + } else .right; // Parse the width parameter const width = comptime parser.specifier() catch |err| @@ -1034,18 +1034,18 @@ pub fn formatBuf( return writer.writeAll(buf); switch (options.alignment) { - .Left => { + .left => { try writer.writeAll(buf); try writer.writeByteNTimes(options.fill, padding); }, - .Center => { + .center => { const left_padding = padding / 2; const right_padding = (padding + 1) / 2; try writer.writeByteNTimes(options.fill, left_padding); try writer.writeAll(buf); try writer.writeByteNTimes(options.fill, right_padding); }, - .Right => { + .right => { try writer.writeByteNTimes(options.fill, padding); try writer.writeAll(buf); },