authorgravatar for meghan@unicycle.coMeghan Denny <meghan@unicycle.co> 2021-07-18 18:08:00 -07:00
committergravatar for meghan@unicycle.coMeghan Denny <meghan@unicycle.co> 2021-07-18 18:08:00 -07:00
log51c7736bc1e0fcefe4c86059c176acf505ea5280
tree1bc8a56d0c5066968941d855a0c9f42428ccb071
parentbc1de4305a1aba2f70ae89675b2dc3eb038fbd5a

util- make trim_suffix always use u8


2 files changed, 3 insertions(+), 3 deletions(-)

src/util/dep.zig+1-1
...@@ -34,7 +34,7 @@ pub const Dep = struct {...@@ -34,7 +34,7 @@ pub const Dep = struct {
34 p = u.trim_prefix(p, "http://");34 p = u.trim_prefix(p, "http://");
35 p = u.trim_prefix(p, "https://");35 p = u.trim_prefix(p, "https://");
36 p = u.trim_prefix(p, "git://");36 p = u.trim_prefix(p, "git://");
37 p = u.trim_suffix(u8, p, ".git");37 p = u.trim_suffix(p, ".git");
38 p = try std.mem.join(gpa, "/", &.{ @tagName(self.type), p });38 p = try std.mem.join(gpa, "/", &.{ @tagName(self.type), p });
39 return p;39 return p;
40 }40 }
src/util/funcs.zig+2-2
...@@ -82,8 +82,8 @@ pub fn _join(comptime delim: []const u8, comptime xs: [][]const u8) []const u8 {...@@ -82,8 +82,8 @@ pub fn _join(comptime delim: []const u8, comptime xs: [][]const u8) []const u8 {
82 return buf;82 return buf;
83}83}
8484
85pub fn trim_suffix(comptime T: type, in: []const T, suffix: []const T) []const T {85pub fn trim_suffix(in: []const u8, suffix: []const u8) []const u8 {
86 if (std.mem.endsWith(T, in, suffix)) {86 if (std.mem.endsWith(u8, in, suffix)) {
87 return in[0 .. in.len - suffix.len];87 return in[0 .. in.len - suffix.len];
88 }88 }
89 return in;89 return in;