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

correct unnecessary uses of 'var' #41

Merged
merged 1 commit into from
Nov 16, 2023
Merged
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
6 changes: 3 additions & 3 deletions known-folders.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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 });
}
Expand Down Expand Up @@ -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 });
Expand Down
Loading