Skip to content

Commit 6484f78

Browse files
Deecellarikskuh
authored andcommitted
remove guesswork
1 parent 3d9deb2 commit 6484f78

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

s2s.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,18 +481,17 @@ fn getSortedErrorNames(comptime T: type) []const []const u8 {
481481
const error_set = @typeInfo(T).ErrorSet orelse @compileError("Cannot serialize anyerror");
482482

483483
var sorted_names: [error_set.len][]const u8 = undefined;
484-
var sorted_names_slice = &sorted_names;
485484
for (error_set, 0..) |err, i| {
486485
sorted_names[i] = err.name;
487486
}
488487

489-
std.sort.sort([]const u8, sorted_names_slice, {}, struct {
488+
std.sort.sort([]const u8, &sorted_names, {}, struct {
490489
fn order(ctx: void, lhs: []const u8, rhs: []const u8) bool {
491490
_ = ctx;
492491
return (std.mem.order(u8, lhs, rhs) == .lt);
493492
}
494493
}.order);
495-
return sorted_names_slice;
494+
return &sorted_names;
496495
}
497496
}
498497

0 commit comments

Comments
 (0)