diff --git a/src/commands.rs b/src/commands.rs index ad5dee8..10ef89c 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -49,7 +49,7 @@ type BoxedDecompressor = Box; fn get_compressor(file: &File) -> crate::Result<(Option, BoxedCompressor)> { let extension = match &file.extension { - Some(extension) => extension.clone(), + Some(extension) => extension, None => { // This is reached when the output file given does not have an extension or has an unsupported one return Err(crate::Error::MissingExtensionError(file.path.to_path_buf())); @@ -58,7 +58,7 @@ fn get_compressor(file: &File) -> crate::Result<(Option, BoxedC // Supported first compressors: // .tar and .zip - let first_compressor: Option> = match extension.first_ext { + let first_compressor: Option> = match &extension.first_ext { Some(ext) => match ext { CompressionFormat::Tar => Some(Box::new(TarCompressor)), CompressionFormat::Zip => Some(Box::new(ZipCompressor)), @@ -84,7 +84,7 @@ fn get_compressor(file: &File) -> crate::Result<(Option, BoxedC fn get_decompressor(file: &File) -> crate::Result<(Option, BoxedDecompressor)> { let extension = match &file.extension { - Some(extension) => extension.clone(), + Some(extension) => extension, None => { // This block *should* be unreachable eprintln!( @@ -104,7 +104,7 @@ fn get_decompressor(file: &File) -> crate::Result<(Option, Bo CompressionFormat::Bzip => Box::new(BzipDecompressor), }; - let first_decompressor: Option> = match extension.first_ext { + let first_decompressor: Option> = match &extension.first_ext { Some(ext) => match ext { CompressionFormat::Tar => Some(Box::new(TarDecompressor)), CompressionFormat::Zip => Some(Box::new(ZipDecompressor)),