authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2023-05-20 22:18:25+01:00
committergravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2023-05-25 20:17:07+01:00
log7860cd734ce1227b3e96e4829de8929d546f78e8
treea32d8c9bf759cc7de6540642bb7ea8b91548e8ef
parent230ea411f72303607a8c5c5467258eee61bd6939

std.fmt: Rename Alignment enum values to snake case


1 files changed, 11 insertions(+), 11 deletions(-)

lib/std/fmt.zig+11-11
......@@ -14,15 +14,15 @@ const expectFmt = std.testing.expectFmt;
1414pub const default_max_depth = 3;
1515
1616pub const Alignment = enum {
17 Left,
18 Center,
19 Right,
17 left,
18 center,
19 right,
2020};
2121
2222pub const FormatOptions = struct {
2323 precision: ?usize = null,
2424 width: ?usize = null,
25 alignment: Alignment = .Right,
25 alignment: Alignment = .right,
2626 fill: u8 = ' ',
2727};
2828
......@@ -252,11 +252,11 @@ pub const Placeholder = struct {
252252 else => {},
253253 }
254254 break :init switch (ch) {
255 '<' => .Left,
256 '^' => .Center,
257 else => .Right,
255 '<' => .left,
256 '^' => .center,
257 else => .right,
258258 };
259 } else .Right;
259 } else .right;
260260
261261 // Parse the width parameter
262262 const width = comptime parser.specifier() catch |err|
......@@ -1034,18 +1034,18 @@ pub fn formatBuf(
10341034 return writer.writeAll(buf);
10351035
10361036 switch (options.alignment) {
1037 .Left => {
1037 .left => {
10381038 try writer.writeAll(buf);
10391039 try writer.writeByteNTimes(options.fill, padding);
10401040 },
1041 .Center => {
1041 .center => {
10421042 const left_padding = padding / 2;
10431043 const right_padding = (padding + 1) / 2;
10441044 try writer.writeByteNTimes(options.fill, left_padding);
10451045 try writer.writeAll(buf);
10461046 try writer.writeByteNTimes(options.fill, right_padding);
10471047 },
1048 .Right => {
1048 .right => {
10491049 try writer.writeByteNTimes(options.fill, padding);
10501050 try writer.writeAll(buf);
10511051 },