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:
mlugg
2023-06-22 18:46:56 +01:00
committed by Andrew Kelley
parent 447ca4e3ff
commit f26dda2117
651 changed files with 8967 additions and 9039 deletions

View File

@@ -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;
}