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

Latest zig requires immutable vars to be 'const' #15

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/Parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ fn putMatchedArg(self: *Parser, arg: *const Arg, value: arg_matches.MatchedArgVa
try self.verifyValuesLength(arg, value.count());

var matches = &self.arg_matches;
var maybe_old_value = matches.args.getPtr(arg.name);
const maybe_old_value = matches.args.getPtr(arg.name);

if (maybe_old_value) |old_value| {
// To fix the const error
Expand Down
2 changes: 1 addition & 1 deletion src/arg_matches.zig
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub const ArgMatches = struct {
pub fn setSubcommand(self: *ArgMatches, subcommand: MatchedSubCommand) !void {
if (self.subcommand != null) return;

var alloc_subcmd = try self.allocator.create(MatchedSubCommand);
const alloc_subcmd = try self.allocator.create(MatchedSubCommand);
alloc_subcmd.* = subcommand;
self.subcommand = alloc_subcmd;
}
Expand Down
2 changes: 1 addition & 1 deletion src/help.zig
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub const Help = struct {

pub fn writeAll(self: *Help, stream: anytype) !void {
var buffer = std.io.bufferedWriter(stream);
var writer = buffer.writer();
const writer = buffer.writer();

try self.writeDescription(writer);
try self.writeHeader(writer);
Expand Down
2 changes: 1 addition & 1 deletion src/test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ test "Option with allowed values" {
var app = App.init(allocator, "clang", null);
errdefer app.deinit();

var stdd = Arg.singleValueOptionWithValidValues(
const stdd = Arg.singleValueOptionWithValidValues(
"std",
null,
null,
Expand Down