Skip to content

Commit 94dd8ce

Browse files
rework how characters identified as valid are consumed
1 parent a984a7c commit 94dd8ce

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
@@ -259,8 +259,8 @@ pub const Placeholder = struct {
259259
const alignment: ?Alignment = comptime if (parser.peek(0)) |ch| init: {
260260
switch (ch) {
261261
'<', '^', '>' => {
262-
_ = parser.char(); // consume the character
263-
break :init switch (ch) {
262+
// consume the character
263+
break :init switch (parser.char().?) {
264264
'<' => .left,
265265
'^' => .center,
266266
else => .right,
@@ -277,8 +277,7 @@ pub const Placeholder = struct {
277277
switch (ch) {
278278
'1'...'9', '.' => break :init null,
279279
else => {
280-
_ = parser.char(); // consume the character
281-
break :init ch;
280+
break :init parser.char().?;
282281
},
283282
}
284283
} else null;

0 commit comments

Comments
 (0)