diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-11-26 09:48:12 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-01-02 17:12:57 -0700 |
| commit | dd973fb365dbbe11ce5beac8b4889bfab3fddc4d (patch) | |
| tree | e82adf746186ec50e1aa11c5bd9f4a677e93046d /lib/std/builtin.zig | |
| parent | 5a06fdfa5525920810005e73eaa1b6e79a6472ca (diff) | |
| download | zig-dd973fb365dbbe11ce5beac8b4889bfab3fddc4d.tar.gz zig-dd973fb365dbbe11ce5beac8b4889bfab3fddc4d.zip | |
std: Use {s} instead of {} when printing strings
Diffstat (limited to 'lib/std/builtin.zig')
| -rw-r--r-- | lib/std/builtin.zig | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index fbc4a7cef5..c883e03ba9 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -67,12 +67,12 @@ pub const StackTrace = struct { var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); defer arena.deinit(); const debug_info = std.debug.getSelfDebugInfo() catch |err| { - return writer.print("\nUnable to print stack trace: Unable to open debug info: {}\n", .{@errorName(err)}); + return writer.print("\nUnable to print stack trace: Unable to open debug info: {s}\n", .{@errorName(err)}); }; const tty_config = std.debug.detectTTYConfig(); try writer.writeAll("\n"); std.debug.writeStackTrace(self, writer, &arena.allocator, debug_info, tty_config) catch |err| { - try writer.print("Unable to print stack trace: {}\n", .{@errorName(err)}); + try writer.print("Unable to print stack trace: {s}\n", .{@errorName(err)}); }; try writer.writeAll("\n"); } @@ -529,12 +529,12 @@ pub const Version = struct { if (fmt.len == 0) { if (self.patch == 0) { if (self.minor == 0) { - return std.fmt.format(out_stream, "{}", .{self.major}); + return std.fmt.format(out_stream, "{d}", .{self.major}); } else { - return std.fmt.format(out_stream, "{}.{}", .{ self.major, self.minor }); + return std.fmt.format(out_stream, "{d}.{d}", .{ self.major, self.minor }); } } else { - return std.fmt.format(out_stream, "{}.{}.{}", .{ self.major, self.minor, self.patch }); + return std.fmt.format(out_stream, "{d}.{d}.{d}", .{ self.major, self.minor, self.patch }); } } else { @compileError("Unknown format string: '" ++ fmt ++ "'"); @@ -683,7 +683,7 @@ pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace) noreturn } }, .wasi => { - std.debug.warn("{}", .{msg}); + std.debug.warn("{s}", .{msg}); std.os.abort(); }, .uefi => { @@ -692,7 +692,7 @@ pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace) noreturn }, else => { const first_trace_addr = @returnAddress(); - std.debug.panicExtra(error_return_trace, first_trace_addr, "{}", .{msg}); + std.debug.panicExtra(error_return_trace, first_trace_addr, "{s}", .{msg}); }, } } |
