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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 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
6 changes: 3 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,11 @@ pub const Specifier = union(enum) {
named: []const u8,
};

/// Intended for parsing std.fmt format strings without having to replicate the

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A doc comment should be about the functionality of the commented variable, rather than about its intention.

Something like "A stream based parser for format strings", perhaps.

But "what this does" rather than "why this is here".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the doc to "what-this-is" followed by "when-to-use" 👍

/// 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