aboutsummaryrefslogtreecommitdiff
path: root/src/resinator/source_mapping.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/source_mapping.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/source_mapping.zig')
-rw-r--r--src/resinator/source_mapping.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/resinator/source_mapping.zig b/src/resinator/source_mapping.zig
index 27e888f87a..f8f99de401 100644
--- a/src/resinator/source_mapping.zig
+++ b/src/resinator/source_mapping.zig
@@ -251,7 +251,7 @@ pub fn handleLineCommand(allocator: Allocator, line_command: []const u8, current
}
pub fn parseAndRemoveLineCommandsAlloc(allocator: Allocator, source: []const u8, options: ParseAndRemoveLineCommandsOptions) !ParseLineCommandsResult {
- var buf = try allocator.alloc(u8, source.len);
+ const buf = try allocator.alloc(u8, source.len);
errdefer allocator.free(buf);
var result = try parseAndRemoveLineCommands(allocator, source, buf, options);
result.result = try allocator.realloc(buf, result.result.len);
@@ -440,7 +440,7 @@ pub const SourceMappings = struct {
}
pub fn set(self: *SourceMappings, allocator: Allocator, line_num: usize, span: SourceSpan) !void {
- var ptr = try self.expandAndGet(allocator, line_num);
+ const ptr = try self.expandAndGet(allocator, line_num);
ptr.* = span;
}