authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-12-12 15:19:23 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-12-12 15:19:23 -08:00
log253618aa24bfe2a670e5114c6681bda034d77b05
treec2f062fa14f61148e17690e5b899c7707655e748
parente7ede19e6f7cfb97574bf69b442cefa48181be12

condense continue calls


1 files changed, 2 insertions(+), 6 deletions(-)

src/lib.zig+2-6
...@@ -117,9 +117,7 @@ pub fn fileList(alloc: *std.mem.Allocator, dir: std.fs.Dir) ![]string {...@@ -117,9 +117,7 @@ pub fn fileList(alloc: *std.mem.Allocator, dir: std.fs.Dir) ![]string {
117 var walk = try dir.walk(alloc);117 var walk = try dir.walk(alloc);
118 defer walk.deinit();118 defer walk.deinit();
119 while (try walk.next()) |entry| {119 while (try walk.next()) |entry| {
120 if (entry.kind != .File) {120 if (entry.kind != .File) continue;
121 continue;
122 }
123 try list.append(try alloc.dupe(u8, entry.path));121 try list.append(try alloc.dupe(u8, entry.path));
124 }122 }
125 return list.toOwnedSlice();123 return list.toOwnedSlice();
...@@ -131,9 +129,7 @@ pub fn dirSize(alloc: *std.mem.Allocator, dir: std.fs.Dir) !usize {...@@ -131,9 +129,7 @@ pub fn dirSize(alloc: *std.mem.Allocator, dir: std.fs.Dir) !usize {
131 var walk = try dir.walk(alloc);129 var walk = try dir.walk(alloc);
132 defer walk.deinit();130 defer walk.deinit();
133 while (try walk.next()) |entry| {131 while (try walk.next()) |entry| {
134 if (entry.kind != .File) {132 if (entry.kind != .File) continue;
135 continue;
136 }
137 res += try fileSize(dir, entry.path);133 res += try fileSize(dir, entry.path);
138 }134 }
139 return res;135 return res;