mirror of
https://git.robbyzambito.me/zaprus
synced 2025-12-20 08:14:50 +00:00
Remove unnecessary explicit cast
Remove unnecessary Self declaration.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user