Fix silent zig fmt errors (#21948)
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run

This commit is contained in:
Daniel Hooper 2024-11-11 01:24:14 -08:00 committed by GitHub
parent f83bb94ca6
commit 560d6b99d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,7 +3,6 @@ const mem = std.mem;
const fs = std.fs; const fs = std.fs;
const process = std.process; const process = std.process;
const Allocator = std.mem.Allocator; const Allocator = std.mem.Allocator;
const warn = std.log.warn;
const Color = std.zig.Color; const Color = std.zig.Color;
const usage_fmt = const usage_fmt =
@ -214,7 +213,7 @@ fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool, dir: fs.Dir, sub_
fmtPathFile(fmt, file_path, check_mode, dir, sub_path) catch |err| switch (err) { fmtPathFile(fmt, file_path, check_mode, dir, sub_path) catch |err| switch (err) {
error.IsDir, error.AccessDenied => return fmtPathDir(fmt, file_path, check_mode, dir, sub_path), error.IsDir, error.AccessDenied => return fmtPathDir(fmt, file_path, check_mode, dir, sub_path),
else => { else => {
warn("unable to format '{s}': {s}", .{ file_path, @errorName(err) }); std.log.err("unable to format '{s}': {s}", .{ file_path, @errorName(err) });
fmt.any_error = true; fmt.any_error = true;
return; return;
}, },
@ -248,7 +247,7 @@ fn fmtPathDir(
try fmtPathDir(fmt, full_path, check_mode, dir, entry.name); try fmtPathDir(fmt, full_path, check_mode, dir, entry.name);
} else { } else {
fmtPathFile(fmt, full_path, check_mode, dir, entry.name) catch |err| { fmtPathFile(fmt, full_path, check_mode, dir, entry.name) catch |err| {
warn("unable to format '{s}': {s}", .{ full_path, @errorName(err) }); std.log.err("unable to format '{s}': {s}", .{ full_path, @errorName(err) });
fmt.any_error = true; fmt.any_error = true;
return; return;
}; };