diff --git a/src/lib.rs b/src/lib.rs index 8fd0021..fa34c5a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,7 +37,7 @@ impl Chunk { } } -pub fn fix(mut bytes: Vec) -> Vec { +pub fn fix(bytes: Vec) -> Vec { let mut bufread = Cursor::new(bytes); // read the png header @@ -47,7 +47,7 @@ pub fn fix(mut bytes: Vec) -> Vec { let mut chunks = Vec::new(); let mut lenbuf = [0; 4]; - while let Ok(_) = bufread.read_exact(&mut lenbuf) { + while bufread.read_exact(&mut lenbuf).is_ok() { let len = u32::from_be_bytes(lenbuf); let mut kind = [0; 4]; diff --git a/src/main.rs b/src/main.rs index eebecbe..0f492f2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -75,8 +75,8 @@ fn main() { for thatpath in filelist { println!("Filename: {:?}", thatpath); - let frfr = read(thatpath.to_owned()).expect("wtf the path doesnt exist"); - let mut fr = lib::fix(frfr); + let frfr = read(&thatpath).expect("wtf the path doesnt exist"); + let fr = lib::fix(frfr); write(thatpath, fr).expect("file could not write btw"); } }