From 4c6164801a2c55327ecaf8889b770d34e04a84ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marcos?= Date: Sat, 3 May 2025 19:46:10 -0300 Subject: [PATCH] fmt --- src/archive/bzip3_stub.rs | 14 +++++++------- src/archive/mod.rs | 4 ++-- src/commands/compress.rs | 2 +- src/commands/decompress.rs | 7 +++---- src/commands/list.rs | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/archive/bzip3_stub.rs b/src/archive/bzip3_stub.rs index 2de3534..e1db197 100644 --- a/src/archive/bzip3_stub.rs +++ b/src/archive/bzip3_stub.rs @@ -1,7 +1,7 @@ -use crate::Error; - -pub fn no_support() -> Error { - Error::UnsupportedFormat { - reason: "BZip3 support is disabled for this build, possibly due to missing bindgen-cli dependency.".into(), - } -} +use crate::Error; + +pub fn no_support() -> Error { + Error::UnsupportedFormat { + reason: "BZip3 support is disabled for this build, possibly due to missing bindgen-cli dependency.".into(), + } +} diff --git a/src/archive/mod.rs b/src/archive/mod.rs index 897b952..6412a8a 100644 --- a/src/archive/mod.rs +++ b/src/archive/mod.rs @@ -1,5 +1,7 @@ //! Archive compression algorithms +#[cfg(not(feature = "bzip3"))] +pub mod bzip3_stub; #[cfg(feature = "unrar")] pub mod rar; #[cfg(not(feature = "unrar"))] @@ -7,5 +9,3 @@ pub mod rar_stub; pub mod sevenz; pub mod tar; pub mod zip; -#[cfg(not(feature = "bzip3"))] -pub mod bzip3_stub; diff --git a/src/commands/compress.rs b/src/commands/compress.rs index 83c18a5..15880bd 100644 --- a/src/commands/compress.rs +++ b/src/commands/compress.rs @@ -66,7 +66,7 @@ pub fn compress_files( // Use block size of 16 MiB bzip3::write::Bz3Encoder::new(encoder, 16 * 2_usize.pow(20))?, ) - }, + } Lz4 => Box::new(lz4_flex::frame::FrameEncoder::new(encoder).auto_finish()), Lzma => Box::new(xz2::write::XzEncoder::new( encoder, diff --git a/src/commands/decompress.rs b/src/commands/decompress.rs index ed0acf7..a108c16 100644 --- a/src/commands/decompress.rs +++ b/src/commands/decompress.rs @@ -6,6 +6,8 @@ use std::{ use fs_err as fs; +#[cfg(not(feature = "bzip3"))] +use crate::archive; use crate::{ commands::{warn_user_about_loading_sevenz_in_memory, warn_user_about_loading_zip_in_memory}, extension::{ @@ -23,9 +25,6 @@ use crate::{ QuestionAction, QuestionPolicy, BUFFER_CAPACITY, }; -#[cfg(not(feature = "bzip3"))] -use crate::archive; - trait ReadSeek: Read + io::Seek {} impl ReadSeek for T {} @@ -127,7 +126,7 @@ pub fn decompress_file(options: DecompressOptions) -> crate::Result<()> { #[cfg(feature = "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)), diff --git a/src/commands/list.rs b/src/commands/list.rs index 5b3c804..b3405b4 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs @@ -56,7 +56,7 @@ pub fn list_archive_contents( #[cfg(feature = "bzip3")] Box::new(bzip3::read::Bz3Decoder::new(decoder).unwrap()) - }, + } 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)),