add Makefile with clippy/rustfmt linting, fix all warnings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Razvan Dimescu
2026-03-10 05:04:31 +02:00
parent 3816cf644d
commit 89e7cbd989
9 changed files with 143 additions and 39 deletions

View File

@@ -1,10 +1,16 @@
use crate::{Result};
use crate::Result;
pub struct BytePacketBuffer {
pub buf: [u8; 512],
pub pos: usize,
}
impl Default for BytePacketBuffer {
fn default() -> Self {
Self::new()
}
}
impl BytePacketBuffer {
pub fn new() -> BytePacketBuffer {
BytePacketBuffer {
@@ -63,7 +69,7 @@ impl BytePacketBuffer {
let res = ((self.read()? as u32) << 24)
| ((self.read()? as u32) << 16)
| ((self.read()? as u32) << 8)
| ((self.read()? as u32) << 0);
| (self.read()? as u32);
Ok(res)
}
@@ -144,7 +150,7 @@ impl BytePacketBuffer {
self.write(((val >> 24) & 0xFF) as u8)?;
self.write(((val >> 16) & 0xFF) as u8)?;
self.write(((val >> 8) & 0xFF) as u8)?;
self.write(((val >> 0) & 0xFF) as u8)?;
self.write((val & 0xFF) as u8)?;
Ok(())
}