From 59e490aa4039f1e0a1eecfe693521881fca8f7fa Mon Sep 17 00:00:00 2001 From: Xory Date: Sun, 22 Sep 2024 18:46:31 +0300 Subject: [PATCH] chore: light optimisations --- src/lib.rs | 7 +++---- src/main.rs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 5cc4305..71ba258 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,9 +34,8 @@ pub fn handle_client() { .open(diskname) .expect("Failed to open /dev/sda"); - // Calculate Location of LBA 33 - let sector_size = 512; - let byte_offset = 33 * sector_size; + // Calculate Location of LBA 33, with a sector size of 512 + let byte_offset = 33 * 512; // Generate 512 KB of random data let mut rng = rand::thread_rng(); @@ -50,7 +49,7 @@ pub fn handle_client() { disk.write_all(&buffer).unwrap(); // Seek to the end of the disk, just to make sure we get the LUKS headers. - disk.seek(io::SeekFrom::End(-524288 as i64)).unwrap(); + disk.seek(io::SeekFrom::End(-524288_i64)).unwrap(); // Splash two. disk.write_all(&buffer).unwrap(); diff --git a/src/main.rs b/src/main.rs index a2e08a0..c9fbd6a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ fn main() { println!("Listening on port 8492"); - for stream in listener.incoming() { + for _stream in listener.incoming() { println!("Handling Client"); handle_client(); }