From 8edd8d2e1c17ed6724386c465061806c2a2cbc07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20M=2E=20Bezerra?= Date: Thu, 21 Sep 2023 19:09:49 -0300 Subject: [PATCH] Replace `.unwrap()`s by `?` --- src/commands/compress.rs | 2 +- src/commands/decompress.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/compress.rs b/src/commands/compress.rs index 986b11d..180bb2e 100644 --- a/src/commands/compress.rs +++ b/src/commands/compress.rs @@ -97,7 +97,7 @@ pub fn compress_files( match first_format { Gzip | Bzip | Bzip3 | Lz4 | Lzma | Snappy | Zstd => { writer = chain_writer_encoder(&first_format, writer)?; - let mut reader = fs::File::open(&files[0]).unwrap(); + let mut reader = fs::File::open(&files[0])?; io::copy(&mut reader, &mut writer)?; } diff --git a/src/commands/decompress.rs b/src/commands/decompress.rs index 3674c4b..7c5c842 100644 --- a/src/commands/decompress.rs +++ b/src/commands/decompress.rs @@ -100,7 +100,7 @@ pub fn decompress_file( let decoder: Box = match format { Gzip => Box::new(flate2::read::GzDecoder::new(decoder)), Bzip => Box::new(bzip2::read::BzDecoder::new(decoder)), - Bzip3 => Box::new(bzip3::read::Bz3Decoder::new(decoder).unwrap()), + Bzip3 => Box::new(bzip3::read::Bz3Decoder::new(decoder)?), Lz4 => Box::new(lz4_flex::frame::FrameDecoder::new(decoder)), Lzma => Box::new(xz2::read::XzDecoder::new(decoder)), Snappy => Box::new(snap::read::FrameDecoder::new(decoder)),