authorgravatar for data-man@users.noreply.github.comDmitry Atamanov <data-man@users.noreply.github.com> 2020-05-26 22:53:51+05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-05-26 20:53:51+03:00
logdd62f63c04fa21427869abea86bbc5fc090b6562
tree756a0a1603f0f2cef1b3b0efebb2ca0d83916b41
parent19a04d8ebd4d671a7f461048555831a629243b49
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

fmt padding correction (#5403)

* Make .Left as default

1 files changed, 2 insertions(+), 3 deletions(-)

lib/std/fmt.zig+2-3
......@@ -17,7 +17,7 @@ pub const Alignment = enum {
1717pub const FormatOptions = struct {
1818 precision: ?usize = null,
1919 width: ?usize = null,
20 alignment: ?Alignment = null,
20 alignment: Alignment = .Left,
2121 fill: u8 = ' ',
2222};
2323
......@@ -596,10 +596,9 @@ pub fn formatBuf(
596596 out_stream: var,
597597) !void {
598598 const width = options.width orelse buf.len;
599 const alignment = options.alignment orelse .Left;
600599 var padding = if (width > buf.len) (width - buf.len) else 0;
601600 const pad_byte = [1]u8{options.fill};
602 switch (alignment) {
601 switch (options.alignment) {
603602 .Left => {
604603 try out_stream.writeAll(buf);
605604 while (padding > 0) : (padding -= 1) {