diff --git a/src/main.rs b/src/main.rs index c217a7d..5818f1b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,12 +25,10 @@ async fn main() -> std::io::Result<()> { panic!("Not enough arguments"); } let filename: String = argv.nth(1).unwrap(); - let buf = File::open(&filename) - .await - .expect("Failed to open input file."); + let buf = File::open(&filename); magick_rust::magick_wand_genesis(); - let buf = BufReader::new(buf).compat(); + let buf = BufReader::new(buf.await.expect("Failed to open input file")).compat(); let mut zip = ZipFileReader::new(buf) .await .expect("Failed to decompress input file."); @@ -42,13 +40,12 @@ async fn main() -> std::io::Result<()> { for i in 0..zip.file().entries().len() { let file = zip.file().entries().get(i).unwrap().clone(); let filename = file.filename(); - let mut entry = zip - .reader_with_entry(i) - .await - .expect("Failed to get zip individual file."); + let entry = zip.reader_with_entry(i); let mut buf = vec![]; let n = entry + .await + .expect("Failed to get zip individual file.") .read_to_end_checked(&mut buf) .await .expect("Failed to read the zip individual file.");