mirror of
https://git.robbyzambito.me/zaprus
synced 2025-12-20 16:24: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
|
file_transfer: void, // unimplemented
|
||||||
connection: Connection,
|
connection: Connection,
|
||||||
|
|
||||||
const Self = @This();
|
fn toBytes(self: SaprusMessage, allocator: Allocator) ![]u8 {
|
||||||
|
|
||||||
fn toBytes(s: Self, allocator: Allocator) ![]u8 {
|
|
||||||
var buf = std.ArrayList(u8).init(allocator);
|
var buf = std.ArrayList(u8).init(allocator);
|
||||||
const w = buf.writer();
|
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| {
|
.relay => |r| {
|
||||||
try w.writeStructEndian(r.header, .big);
|
try w.writeStructEndian(r.header, .big);
|
||||||
try w.writeInt(u16, @intCast(r.payload.len), .big);
|
try w.writeInt(u16, @intCast(r.payload.len), .big);
|
||||||
|
|||||||
Reference in New Issue
Block a user