applied clippy

This commit is contained in:
Fabian Schmidt 2024-07-25 13:05:53 +02:00
parent e230a5ce2c
commit c6b8273d65
2 changed files with 3 additions and 4 deletions

View File

@ -21,7 +21,6 @@ fn main() {
let file = File::open(FILE_PATH).expect("File measurements.txt not found"); let file = File::open(FILE_PATH).expect("File measurements.txt not found");
let mut reader = BufReader::new(&file); let mut reader = BufReader::new(&file);
let file_length = reader.seek(SeekFrom::End(0)).unwrap(); let file_length = reader.seek(SeekFrom::End(0)).unwrap();
println!("file_length = {file_length}");
let chunk_length = file_length as usize / cores; let chunk_length = file_length as usize / cores;
let mut bounds = Vec::with_capacity(cores + 1); let mut bounds = Vec::with_capacity(cores + 1);
bounds.push(0); bounds.push(0);
@ -29,8 +28,8 @@ fn main() {
let mut reader = BufReader::new(&file); let mut reader = BufReader::new(&file);
let mut byte_start = chunk_length * i; let mut byte_start = chunk_length * i;
reader.seek(SeekFrom::Start(byte_start as u64)).expect("could not seek"); reader.seek(SeekFrom::Start(byte_start as u64)).expect("could not seek");
let mut bytes = reader.bytes(); let bytes = reader.bytes();
while let Some(byte) = bytes.next() { for byte in bytes {
match byte { match byte {
Ok(byte) => { Ok(byte) => {
byte_start += 1; byte_start += 1;

View File

@ -71,7 +71,7 @@ pub fn parse_temp(bytes: &[u8]) -> isize {
#[inline] #[inline]
pub fn read_bytes_until(bytes: &mut Bytes<BufReader<&File>>, delimiter: u8) -> Option<Vec<u8>> { pub fn read_bytes_until(bytes: &mut Bytes<BufReader<&File>>, delimiter: u8) -> Option<Vec<u8>> {
let mut buf: Vec<u8> = Vec::with_capacity(108); let mut buf: Vec<u8> = Vec::with_capacity(108);
while let Some(byte) = bytes.next() { for byte in bytes {
if byte.is_err() { if byte.is_err() {
panic!("Could not read byte"); panic!("Could not read byte");
} }