diff --git a/src/cmd/fetch.zig b/src/cmd/fetch.zig index 6713694525fe1437106ab58e56bb5d0acdcf6118..f3b646d64b56a9a11096284e4e0dd292d09dc191 100644 --- a/src/cmd/fetch.zig +++ b/src/cmd/fetch.zig @@ -407,7 +407,7 @@ fn print_pkg_data_to(w: std.fs.File.Writer, notdone: *std.ArrayList(zigmod.Modul /// returns if all of the zig modules in needles are in haystack fn contains_all(needles: []zigmod.Module, haystack: []const zigmod.Module) bool { for (needles) |item| { - if (item.main.len > 0 and !u.list_contains_gen(zigmod.Module, haystack, item)) { + if (item.main.len > 0 and !extras.containsAggregate(zigmod.Module, haystack, item)) { return false; } } diff --git a/src/cmd/generate.zig b/src/cmd/generate.zig index 5dcf4363ff5d085d6810c6cac8225987853ab4da..0bf78bd08eab0d8659e887896603db47388673a5 100644 --- a/src/cmd/generate.zig +++ b/src/cmd/generate.zig @@ -1,5 +1,6 @@ const std = @import("std"); const string = []const u8; +const extras = @import("extras"); const zigmod = @import("../lib.zig"); const u = @import("./../util/index.zig"); @@ -356,7 +357,7 @@ fn print_pkg_data_to(w: std.fs.File.Writer, alloc: std.mem.Allocator, cachepath: /// returns if all of the zig modules in needles are in haystack fn contains_all(needles: []zigmod.Module, haystack: []const zigmod.Module) bool { for (needles) |item| { - if (item.main.len > 0 and !u.list_contains_gen(zigmod.Module, haystack, item)) { + if (item.main.len > 0 and !extras.containsAggregate(zigmod.Module, haystack, item)) { return false; } } diff --git a/src/common.zig b/src/common.zig index e9d3009e4590a1f514efca17b47fc28957ebd675..808fa2e8b04cd68e5a8b806b72c9eefe9b03417e 100644 --- a/src/common.zig +++ b/src/common.zig @@ -90,7 +90,7 @@ pub fn collect_deps(cachepath: string, mdir: std.fs.Dir, dtype: zigmod.Dep.Type, } pub fn collect_pkgs(mod: zigmod.Module, list: *std.ArrayList(zigmod.Module)) anyerror!void { - if (u.list_contains_gen(zigmod.Module, list.items, mod)) { + if (extras.containsAggregate(zigmod.Module, list.items, mod)) { return; } try list.append(mod); diff --git a/src/util/funcs.zig b/src/util/funcs.zig index d4227029e6b591d57e1113fa93cc122610447d3e..d5833b2a1c6e8fd8b5ec69d41d593a952c1f5753 100644 --- a/src/util/funcs.zig +++ b/src/util/funcs.zig @@ -46,15 +46,6 @@ pub fn split(alloc: std.mem.Allocator, in: string, delim: string) ![]string { return list.toOwnedSlice(); } -pub fn list_contains_gen(comptime T: type, haystack: []const T, needle: T) bool { - for (haystack) |item| { - if (item.eql(needle)) { - return true; - } - } - return false; -} - pub fn file_list(alloc: std.mem.Allocator, dpath: string) ![]const string { var dir = try std.fs.cwd().openIterableDir(dpath, .{}); defer dir.close();