Skip to content

Commit

Permalink
Merge pull request #15 from karlseguin/main
Browse files Browse the repository at this point in the history
Latest zig requires immutable vars to be 'const'
  • Loading branch information
prajwalch authored Nov 27, 2023
2 parents 06315c9 + 9cb8844 commit 71e7e56
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
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

0 comments on commit 71e7e56

Please sign in to comment.