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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user