cargo clippy --fix ROUND 1

This commit is contained in:
endernon 2024-12-25 00:38:00 +00:00
parent 5cf198b8e1
commit c38fe8bba5
2 changed files with 4 additions and 4 deletions

View file

@ -37,7 +37,7 @@ impl Chunk {
} }
} }
pub fn fix(mut bytes: Vec<u8>) -> Vec<u8> { pub fn fix(bytes: Vec<u8>) -> Vec<u8> {
let mut bufread = Cursor::new(bytes); let mut bufread = Cursor::new(bytes);
// read the png header // read the png header
@ -47,7 +47,7 @@ pub fn fix(mut bytes: Vec<u8>) -> Vec<u8> {
let mut chunks = Vec::new(); let mut chunks = Vec::new();
let mut lenbuf = [0; 4]; 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 len = u32::from_be_bytes(lenbuf);
let mut kind = [0; 4]; let mut kind = [0; 4];

View file

@ -75,8 +75,8 @@ fn main() {
for thatpath in filelist { for thatpath in filelist {
println!("Filename: {:?}", thatpath); println!("Filename: {:?}", thatpath);
let frfr = read(thatpath.to_owned()).expect("wtf the path doesnt exist"); let frfr = read(&thatpath).expect("wtf the path doesnt exist");
let mut fr = lib::fix(frfr); let fr = lib::fix(frfr);
write(thatpath, fr).expect("file could not write btw"); write(thatpath, fr).expect("file could not write btw");
} }
} }