diff options
author | Robby Zambito <contact@robbyzambito.me> | 2025-04-03 10:54:04 -0400 |
---|---|---|
committer | Robby Zambito <contact@robbyzambito.me> | 2025-04-06 13:08:09 -0400 |
commit | cc94c77cfb61a54a5902e8b36ee0b56460cba69f (patch) | |
tree | 8ae78df40ebee3f6f53e7b75c09b6c6b4ed39ea3 /src/main.zig | |
parent | e38c2b421d8312d2d4264f719f642e3441a8f726 (diff) |
Remove unnecessary explicit cast
Remove unnecessary Self declaration.
Diffstat (limited to 'src/main.zig')
-rw-r--r-- | src/main.zig | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/main.zig b/src/main.zig index fcda038..fd77d30 100644 --- a/src/main.zig +++ b/src/main.zig @@ -40,14 +40,12 @@ const SaprusMessage = union(SaprusPacketType) { file_transfer: void, // unimplemented connection: Connection, - const Self = @This(); - - fn toBytes(s: Self, allocator: Allocator) ![]u8 { + fn toBytes(self: SaprusMessage, allocator: Allocator) ![]u8 { var buf = std.ArrayList(u8).init(allocator); const w = buf.writer(); - try w.writeInt(u16, @intFromEnum(@as(SaprusPacketType, s)), .big); + try w.writeInt(u16, @intFromEnum(self), .big); - switch (s) { + switch (self) { .relay => |r| { try w.writeStructEndian(r.header, .big); try w.writeInt(u16, @intCast(r.payload.len), .big); |