aboutsummaryrefslogtreecommitdiff
path: root/src/resinator/cli.zig
diff options
context:
space:
mode:
authorMatthew Lugg <mlugg@mlugg.co.uk>2023-11-19 16:19:06 +0000
committerGitHub <noreply@github.com>2023-11-19 16:19:06 +0000
commit6b1a823b2b30d9318c9877dbdbd3d02fa939fba0 (patch)
tree6e5afdad2397ac7224119811583d19107b6e517a /src/resinator/cli.zig
parent325e0f5f0e8a9ce2540ec3ec5b7cbbecac15257a (diff)
parent9cf6c1ad11bb5f0247ff3458cba5f3bd156d1fb9 (diff)
downloadzig-6b1a823b2b30d9318c9877dbdbd3d02fa939fba0.tar.gz
zig-6b1a823b2b30d9318c9877dbdbd3d02fa939fba0.zip
Merge pull request #18017 from mlugg/var-never-mutated
compiler: add error for unnecessary use of 'var'
Diffstat (limited to 'src/resinator/cli.zig')
-rw-r--r--src/resinator/cli.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/resinator/cli.zig b/src/resinator/cli.zig
index 50dbed5ad6..7fb6573c22 100644
--- a/src/resinator/cli.zig
+++ b/src/resinator/cli.zig
@@ -163,15 +163,15 @@ pub const Options = struct {
// we shouldn't change anything.
if (val_ptr.* == .undefine) return;
// Otherwise, the new value takes precedence.
- var duped_value = try self.allocator.dupe(u8, value);
+ const duped_value = try self.allocator.dupe(u8, value);
errdefer self.allocator.free(duped_value);
val_ptr.deinit(self.allocator);
val_ptr.* = .{ .define = duped_value };
return;
}
- var duped_key = try self.allocator.dupe(u8, identifier);
+ const duped_key = try self.allocator.dupe(u8, identifier);
errdefer self.allocator.free(duped_key);
- var duped_value = try self.allocator.dupe(u8, value);
+ const duped_value = try self.allocator.dupe(u8, value);
errdefer self.allocator.free(duped_value);
try self.symbols.put(self.allocator, duped_key, .{ .define = duped_value });
}
@@ -183,7 +183,7 @@ pub const Options = struct {
action.* = .{ .undefine = {} };
return;
}
- var duped_key = try self.allocator.dupe(u8, identifier);
+ const duped_key = try self.allocator.dupe(u8, identifier);
errdefer self.allocator.free(duped_key);
try self.symbols.put(self.allocator, duped_key, .{ .undefine = {} });
}
@@ -828,7 +828,7 @@ pub fn parse(allocator: Allocator, args: []const []const u8, diagnostics: *Diagn
}
}
- var positionals = args[arg_i..];
+ const positionals = args[arg_i..];
if (positionals.len < 1) {
var err_details = Diagnostics.ErrorDetails{ .print_args = false, .arg_index = arg_i };