update format specifiers for optional strings (#564)

This commit is contained in:
haze 2022-07-27 09:41:45 -04:00 committed by GitHub
parent 913d6aee9d
commit 528fd26a13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -159,7 +159,7 @@ pub fn configChanged(config: *Config, allocator: std.mem.Allocator, builtin_crea
// We know this is allocated with `allocator`, we just steal it! // We know this is allocated with `allocator`, we just steal it!
config.zig_lib_path = json_env.lib_dir.?; config.zig_lib_path = json_env.lib_dir.?;
json_env.lib_dir = null; json_env.lib_dir = null;
logger.info("Using zig lib path '{s}'", .{config.zig_lib_path}); logger.info("Using zig lib path '{?s}'", .{config.zig_lib_path});
} }
}, },
else => logger.err("zig env invocation failed", .{}), else => logger.err("zig env invocation failed", .{}),

View File

@ -255,7 +255,7 @@ fn newDocument(self: *DocumentStore, uri: []const u8, text: [:0]u8) anyerror!*Ha
if (build_file.builtin_uri == null) { if (build_file.builtin_uri == null) {
if (self.config.builtin_path != null) { if (self.config.builtin_path != null) {
build_file.builtin_uri = try URI.fromPath(self.allocator, self.config.builtin_path.?); build_file.builtin_uri = try URI.fromPath(self.allocator, self.config.builtin_path.?);
log.info("builtin config not found, falling back to default: {s}", .{build_file.builtin_uri}); log.info("builtin config not found, falling back to default: {?s}", .{build_file.builtin_uri});
} }
} }

View File

@ -51,7 +51,7 @@ pub fn log(comptime message_level: std.log.Level, comptime scope: @Type(.EnumLit
} }
// After shutdown, pipe output to stderr // After shutdown, pipe output to stderr
if (!keep_running) { if (!keep_running) {
std.debug.print("[{s}-{s}] " ++ format ++ "\n", .{ @tagName(message_level), @tagName(scope) } ++ args); std.debug.print("[{?s}-{?s}] " ++ format ++ "\n", .{ @tagName(message_level), @tagName(scope) } ++ args);
return; return;
} }
@ -59,7 +59,7 @@ pub fn log(comptime message_level: std.log.Level, comptime scope: @Type(.EnumLit
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit(); defer arena.deinit();
var message = std.fmt.allocPrint(arena.allocator(), "[{s}-{s}] " ++ format, .{ @tagName(message_level), @tagName(scope) } ++ args) catch { var message = std.fmt.allocPrint(arena.allocator(), "[{?s}-{?s}] " ++ format, .{ @tagName(message_level), @tagName(scope) } ++ args) catch {
std.debug.print("Failed to allocPrint message.\n", .{}); std.debug.print("Failed to allocPrint message.\n", .{});
return; return;
}; };