From 855473062efac722624737f1adc56f9c0dd92017 Mon Sep 17 00:00:00 2001 From: Techatrix <19954306+Techatrix@users.noreply.github.com> Date: Thu, 16 Nov 2023 22:55:20 +0100 Subject: [PATCH] correct unnecessary uses of 'var' --- known-folders.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/known-folders.zig b/known-folders.zig index 945da5c..83ed91e 100644 --- a/known-folders.zig +++ b/known-folders.zig @@ -32,7 +32,7 @@ pub const KnownFolderConfig = struct { /// Returns a directory handle, or, if the folder does not exist, `null`. pub fn open(allocator: std.mem.Allocator, folder: KnownFolder, args: std.fs.Dir.OpenDirOptions) (std.fs.Dir.OpenError || Error)!?std.fs.Dir { - var path_or_null = try getPath(allocator, folder); + const path_or_null = try getPath(allocator, folder); if (path_or_null) |path| { defer allocator.free(path); @@ -177,7 +177,7 @@ fn getPathXdg(allocator: std.mem.Allocator, arena: *std.heap.ArenaAllocator, fol return error.ParseError; } - var subdir = line[start..end]; + const subdir = line[start..end]; break :env_opt try std.mem.concat(arena.allocator(), u8, &[_][]const u8{ home, subdir }); } @@ -338,7 +338,7 @@ comptime { test "query each known folders" { inline for (std.meta.fields(KnownFolder)) |fld| { - var path_or_null = try getPath(std.testing.allocator, @field(KnownFolder, fld.name)); + const path_or_null = try getPath(std.testing.allocator, @field(KnownFolder, fld.name)); if (path_or_null) |path| { // TODO: Remove later std.debug.print("{s} => '{s}'\n", .{ fld.name, path });