Skip to content

Commit b8a2c66

Browse files
committed
tidy namespacing
1 parent 5f2916f commit b8a2c66

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

ClarTestStep.zig

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ pub fn addArgs(clar: *ClarTestStep, args: []const []const u8) void {
3333
for (args) |arg| clar.addArg(arg);
3434
}
3535

36-
fn make(step: *Step, options: std.Build.Step.MakeOptions) !void {
36+
fn make(step: *Step, options: Step.MakeOptions) !void {
3737
const clar: *ClarTestStep = @fieldParentPtr("step", step);
3838
const b = step.owner;
3939
const arena = b.allocator;
4040

4141
var man = b.graph.cache.obtain();
4242
defer man.deinit();
4343

44-
var argv_list = std.ArrayList([]const u8).init(arena);
44+
var argv_list: std.ArrayList([]const u8) = .init(arena);
4545
{
4646
const file_path = clar.runner.installed_path orelse clar.runner.generated_bin.?.path.?;
4747
try argv_list.append(file_path);
@@ -60,7 +60,7 @@ fn make(step: *Step, options: std.Build.Step.MakeOptions) !void {
6060
}
6161

6262
{
63-
var child = std.process.Child.init(argv_list.items, arena);
63+
var child: std.process.Child = .init(argv_list.items, arena);
6464
child.stdin_behavior = .Ignore;
6565
child.stdout_behavior = .Pipe;
6666
child.stderr_behavior = .Ignore;
@@ -162,12 +162,12 @@ const TapParser = struct {
162162
fn parseLine(p: *TapParser, step_arena: Allocator, line: []const u8) Allocator.Error!Result {
163163
loop: switch (p.state) {
164164
.start => {
165-
if (std.mem.startsWith(u8, line, keyword.suite_start)) {
165+
if (mem.startsWith(u8, line, keyword.suite_start)) {
166166
const suite_start = skip(line, keyword.spacer2, keyword.suite_start.len) orelse @panic("expected suite number");
167167
return .{ .start_suite = line[suite_start..] };
168-
} else if (std.mem.startsWith(u8, line, keyword.ok)) {
168+
} else if (mem.startsWith(u8, line, keyword.ok)) {
169169
return .ok;
170-
} else if (std.mem.startsWith(u8, line, keyword.not_ok)) {
170+
} else if (mem.startsWith(u8, line, keyword.not_ok)) {
171171
p.state = .desc;
172172
continue :loop p.state;
173173
}
@@ -176,37 +176,37 @@ const TapParser = struct {
176176
// Failure parsing
177177
.desc => {
178178
const name_start = skip(line, keyword.spacer1, keyword.not_ok.len) orelse @panic("expected spacer");
179-
const name = std.mem.trim(u8, line[name_start..], &std.ascii.whitespace);
179+
const name = mem.trim(u8, line[name_start..], &std.ascii.whitespace);
180180
try p.wip_failure.description.appendSlice(step_arena, name);
181181
try p.wip_failure.description.appendSlice(step_arena, ": ");
182182
p.state = .yaml_start;
183183
},
184184
.yaml_start => {
185-
_ = std.mem.indexOf(u8, line, keyword.yaml_blk) orelse @panic("expected yaml_blk");
185+
_ = mem.indexOf(u8, line, keyword.yaml_blk) orelse @panic("expected yaml_blk");
186186
p.state = .pre_reason;
187187
},
188188
.pre_reason => {
189-
_ = std.mem.indexOf(u8, line, keyword.pre_reason) orelse @panic("expected pre_reason");
189+
_ = mem.indexOf(u8, line, keyword.pre_reason) orelse @panic("expected pre_reason");
190190
p.state = .reason;
191191
},
192192
.reason => {
193-
if (std.mem.indexOf(u8, line, keyword.at) != null) {
193+
if (mem.indexOf(u8, line, keyword.at) != null) {
194194
p.state = .file;
195195
} else {
196-
const ln = std.mem.trim(u8, line, &std.ascii.whitespace);
196+
const ln = mem.trim(u8, line, &std.ascii.whitespace);
197197
try p.wip_failure.reasons.append(step_arena, try step_arena.dupe(u8, ln));
198198
}
199199
},
200200
.file => {
201201
const file_start = skip(line, keyword.file, 0) orelse @panic("expected file");
202-
const file = std.mem.trim(u8, line[file_start..], std.ascii.whitespace ++ "'");
202+
const file = mem.trim(u8, line[file_start..], std.ascii.whitespace ++ "'");
203203
try p.wip_failure.description.appendSlice(step_arena, file);
204204
try p.wip_failure.description.append(step_arena, ':');
205205
p.state = .line;
206206
},
207207
.line => {
208208
const line_start = skip(line, keyword.line, 0) orelse @panic("expected line");
209-
const fail_line = std.mem.trim(u8, line[line_start..], &std.ascii.whitespace);
209+
const fail_line = mem.trim(u8, line[line_start..], &std.ascii.whitespace);
210210
try p.wip_failure.description.appendSlice(step_arena, fail_line);
211211
p.state = .start;
212212
return .{ .failure = p.wip_failure };
@@ -217,7 +217,7 @@ const TapParser = struct {
217217
}
218218

219219
fn skip(line: []const u8, to_skip: []const u8, start: usize) ?usize {
220-
const index = std.mem.indexOfPos(u8, line, start, to_skip) orelse return null;
220+
const index = mem.indexOfPos(u8, line, start, to_skip) orelse return null;
221221
return to_skip.len + index;
222222
}
223223

@@ -235,5 +235,6 @@ const TapParser = struct {
235235
};
236236

237237
const std = @import("std");
238+
const mem = std.mem;
238239
const Step = std.Build.Step;
239-
const Allocator = std.mem.Allocator;
240+
const Allocator = mem.Allocator;

0 commit comments

Comments
 (0)