From f26dda21171e26f44aeec8c59a75bbb3331eeb2e Mon Sep 17 00:00:00 2001 From: mlugg Date: Thu, 22 Jun 2023 18:46:56 +0100 Subject: all: migrate code to new cast builtin syntax Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change --- lib/std/json/write_stream.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/std/json/write_stream.zig') diff --git a/lib/std/json/write_stream.zig b/lib/std/json/write_stream.zig index 760bad13fd..3a2750f5a1 100644 --- a/lib/std/json/write_stream.zig +++ b/lib/std/json/write_stream.zig @@ -176,8 +176,8 @@ pub fn WriteStream(comptime OutStream: type, comptime max_depth: usize) type { .ComptimeInt => { return self.emitNumber(@as(std.math.IntFittingRange(value, value), value)); }, - .Float, .ComptimeFloat => if (@floatCast(f64, value) == value) { - try self.stream.print("{}", .{@floatCast(f64, value)}); + .Float, .ComptimeFloat => if (@as(f64, @floatCast(value)) == value) { + try self.stream.print("{}", .{@as(f64, @floatCast(value))}); self.popState(); return; }, @@ -294,7 +294,7 @@ test "json write stream" { fn getJsonObject(allocator: std.mem.Allocator) !Value { var value = Value{ .object = ObjectMap.init(allocator) }; - try value.object.put("one", Value{ .integer = @intCast(i64, 1) }); + try value.object.put("one", Value{ .integer = @as(i64, @intCast(1)) }); try value.object.put("two", Value{ .float = 2.0 }); return value; } -- cgit v1.2.3