Skip to content

Commit f6a251f

Browse files
rework how characters identified as valid are consumed
1 parent 9e80d7f commit f6a251f

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/std/fmt.zig

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ pub const Placeholder = struct {
260260
const alignment: ?Alignment = comptime if (parser.peek(0)) |ch| init: {
261261
switch (ch) {
262262
'<', '^', '>' => {
263-
_ = parser.char(); // consume the character
264-
break :init switch (ch) {
263+
// consume the character
264+
break :init switch (parser.char().?) {
265265
'<' => .left,
266266
'^' => .center,
267267
else => .right,
@@ -278,8 +278,7 @@ pub const Placeholder = struct {
278278
switch (ch) {
279279
'1'...'9', '.' => break :init null,
280280
else => {
281-
_ = parser.char(); // consume the character
282-
break :init ch;
281+
break :init parser.char().?;
283282
},
284283
}
285284
} else null;

0 commit comments

Comments
 (0)