Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused buf field from std.fmt.Parser #21994

Merged
merged 3 commits into from
Nov 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/std/fmt.zig
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ pub const Placeholder = struct {
pub fn parse(comptime str: anytype) Placeholder {
const view = std.unicode.Utf8View.initComptime(&str);
comptime var parser = Parser{
.buf = &str,
.iter = view.iterator(),
};

Expand Down Expand Up @@ -311,10 +310,13 @@ pub const Specifier = union(enum) {
named: []const u8,
};

/// A stream based parser for format strings.
///
/// Allows to implement formatters compatible with std.fmt without replicating
/// the standard library behavior.
pub const Parser = struct {
buf: []const u8,
pos: usize = 0,
iter: std.unicode.Utf8Iterator = undefined,
iter: std.unicode.Utf8Iterator,

// Returns a decimal number or null if the current character is not a
// digit
Expand Down
Loading