From c6b8273d6562bb21bf98e00ebdfe9ce77c3edb41 Mon Sep 17 00:00:00 2001 From: Fabian Schmidt Date: Thu, 25 Jul 2024 13:05:53 +0200 Subject: [PATCH] applied clippy --- src/main/rust/src/bin/multi_threaded.rs | 5 ++--- src/main/rust/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/rust/src/bin/multi_threaded.rs b/src/main/rust/src/bin/multi_threaded.rs index c549af1..b4317fb 100644 --- a/src/main/rust/src/bin/multi_threaded.rs +++ b/src/main/rust/src/bin/multi_threaded.rs @@ -21,7 +21,6 @@ fn main() { let file = File::open(FILE_PATH).expect("File measurements.txt not found"); let mut reader = BufReader::new(&file); let file_length = reader.seek(SeekFrom::End(0)).unwrap(); - println!("file_length = {file_length}"); let chunk_length = file_length as usize / cores; let mut bounds = Vec::with_capacity(cores + 1); bounds.push(0); @@ -29,8 +28,8 @@ fn main() { let mut reader = BufReader::new(&file); let mut byte_start = chunk_length * i; reader.seek(SeekFrom::Start(byte_start as u64)).expect("could not seek"); - let mut bytes = reader.bytes(); - while let Some(byte) = bytes.next() { + let bytes = reader.bytes(); + for byte in bytes { match byte { Ok(byte) => { byte_start += 1; diff --git a/src/main/rust/src/lib.rs b/src/main/rust/src/lib.rs index 87987bb..101ecf6 100644 --- a/src/main/rust/src/lib.rs +++ b/src/main/rust/src/lib.rs @@ -71,7 +71,7 @@ pub fn parse_temp(bytes: &[u8]) -> isize { #[inline] pub fn read_bytes_until(bytes: &mut Bytes>, delimiter: u8) -> Option> { let mut buf: Vec = Vec::with_capacity(108); - while let Some(byte) = bytes.next() { + for byte in bytes { if byte.is_err() { panic!("Could not read byte"); }