meta: fix redundant qualifiers and improve tuple field generation
This commit is contained in:
parent
70c6cea591
commit
6e1199afa9
@ -210,7 +210,7 @@ pub fn MutatingZSplitter(comptime T: type) type {
|
||||
pub fn copyStruct(comptime T: type, source: T, field_overrides: anytype) T {
|
||||
var result: T = undefined;
|
||||
|
||||
comptime inline for (@typeInfo(@TypeOf(field_overrides)).Struct.fields) |field| {
|
||||
comptime for (@typeInfo(@TypeOf(field_overrides)).Struct.fields) |field| {
|
||||
if (!@hasField(T, field.name)) @compileError("override contains bad field" ++ field);
|
||||
};
|
||||
|
||||
@ -254,9 +254,8 @@ pub const TupleBuilder = struct {
|
||||
comptime {
|
||||
var fields: [self.types.len]StructField = undefined;
|
||||
for (self.types, 0..) |Type, idx| {
|
||||
var num_buf: [128]u8 = undefined;
|
||||
fields[idx] = .{
|
||||
.name = std.fmt.bufPrint(&num_buf, "{d}", .{idx}) catch @compileError("failed to write field"),
|
||||
.name = std.fmt.comptimePrint("{d}", .{idx}),
|
||||
.type = Type,
|
||||
.default_value = null,
|
||||
// TODO: is this the right thing to do?
|
||||
|
Loading…
x
Reference in New Issue
Block a user