From 0d8155f0af3e67bba08ccbed4b254909721a6aa3 Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Thu, 3 Apr 2025 10:54:04 -0400 Subject: Remove unnecessary explicit cast Remove unnecessary Self declaration. --- src/main.zig | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/main.zig') 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); -- cgit