refactor: Remove unnecessary #[cfg] attributes

This commit is contained in:
Chris Hennick 2024-05-15 15:31:17 -07:00
parent 23068ad7c2
commit 819f86537c
No known key found for this signature in database
GPG key ID: DA47AABA4961C509
2 changed files with 20 additions and 43 deletions

View file

@ -12,13 +12,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
#[cfg(feature = "_deflate-any")]
{
let filename = &*args[1];
doit(filename)?;
}
Ok(())
}
#[cfg(feature = "_deflate-any")]
fn doit(filename: &str) -> zip::result::ZipResult<()> {
use std::io::Write;
use zip::write::SimpleFileOptions;
@ -39,5 +32,6 @@ fn doit(filename: &str) -> zip::result::ZipResult<()> {
bytes_written += content.len() as u64;
}
zip.finish()?;
}
Ok(())
}

View file

@ -35,23 +35,6 @@ fn main() {
std::process::exit(real_main());
}
const METHOD_STORED: Option<zip::CompressionMethod> = Some(zip::CompressionMethod::Stored);
#[cfg(feature = "_deflate-any")]
const METHOD_DEFLATED: Option<zip::CompressionMethod> = Some(zip::CompressionMethod::Deflated);
#[cfg(not(feature = "_deflate-any"))]
const METHOD_DEFLATED: Option<zip::CompressionMethod> = None;
#[cfg(feature = "bzip2")]
const METHOD_BZIP2: Option<zip::CompressionMethod> = Some(zip::CompressionMethod::Bzip2);
#[cfg(not(feature = "bzip2"))]
const METHOD_BZIP2: Option<zip::CompressionMethod> = None;
#[cfg(feature = "zstd")]
const METHOD_ZSTD: Option<zip::CompressionMethod> = Some(zip::CompressionMethod::Zstd);
#[cfg(not(feature = "zstd"))]
const METHOD_ZSTD: Option<zip::CompressionMethod> = None;
fn real_main() -> i32 {
let args = Args::parse();
let src_dir = &args.source;