diff --git a/Cargo.toml b/Cargo.toml index b2cb4efb..6212924a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zip" -version = "1.1.1" +version = "1.1.2" authors = [ "Mathijs van de Nes ", "Marli Frost ", @@ -56,6 +56,10 @@ aes-crypto = ["aes", "constant_time_eq", "hmac", "pbkdf2", "sha1"] chrono = ["chrono/default"] _deflate-any = [] deflate = ["flate2/rust_backend", "_deflate-any"] + +# DEPRECATED: previously enabled `flate2/miniz_oxide` which is equivalent to `flate2/rust_backend` +deflate-miniz = ["deflate", "_deflate-any"] + deflate-zlib = ["flate2/zlib", "_deflate-any"] deflate-zlib-ng = ["flate2/zlib-ng", "_deflate-any"] deflate-zopfli = ["zopfli", "_deflate-any"] diff --git a/README.md b/README.md index 43cb7b15..bb9ea7ef 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,10 @@ The features available are: By default `aes-crypto`, `deflate`, `deflate-zlib-ng`, `deflate-zopfli`, `bzip2`, `time` and `zstd` are enabled. +The following feature flags are deprecated: + +* `deflate-miniz`: Use `flate2`'s default backend for compression. Currently the same as `deflate`. + MSRV ---- diff --git a/src/compression.rs b/src/compression.rs index 3e35636c..1862c976 100644 --- a/src/compression.rs +++ b/src/compression.rs @@ -17,12 +17,7 @@ pub enum CompressionMethod { /// Store the file as is Stored, /// Compress the file using Deflate - #[cfg(any( - feature = "deflate", - feature = "deflate-zlib", - feature = "deflate-zlib-ng", - feature = "deflate-zopfli" - ))] + #[cfg(feature = "_deflate-any")] Deflated, /// Compress the file using Deflate64. /// Decoding deflate64 is supported but encoding deflate64 is not supported. @@ -60,19 +55,9 @@ impl CompressionMethod { pub const REDUCE_3: Self = CompressionMethod::Unsupported(4); pub const REDUCE_4: Self = CompressionMethod::Unsupported(5); pub const IMPLODE: Self = CompressionMethod::Unsupported(6); - #[cfg(any( - feature = "deflate", - feature = "deflate-zlib", - feature = "deflate-zlib-ng", - feature = "deflate-zopfli" - ))] + #[cfg(feature = "_deflate-any")] pub const DEFLATE: Self = CompressionMethod::Deflated; - #[cfg(not(any( - feature = "deflate", - feature = "deflate-zlib", - feature = "deflate-zlib-ng", - feature = "deflate-zopfli" - )))] + #[cfg(not(feature = "_deflate-any"))] pub const DEFLATE: Self = CompressionMethod::Unsupported(8); #[cfg(feature = "deflate64")] pub const DEFLATE64: Self = CompressionMethod::Deflate64; @@ -114,12 +99,7 @@ impl CompressionMethod { #[allow(deprecated)] match val { 0 => CompressionMethod::Stored, - #[cfg(any( - feature = "deflate", - feature = "deflate-zlib", - feature = "deflate-zlib-ng", - feature = "deflate-zopfli" - ))] + #[cfg(feature = "_deflate-any")] 8 => CompressionMethod::Deflated, #[cfg(feature = "deflate64")] 9 => CompressionMethod::Deflate64, @@ -145,12 +125,7 @@ impl CompressionMethod { #[allow(deprecated)] match self { CompressionMethod::Stored => 0, - #[cfg(any( - feature = "deflate", - feature = "deflate-zlib", - feature = "deflate-zlib-ng", - feature = "deflate-zopfli" - ))] + #[cfg(feature = "_deflate-any")] CompressionMethod::Deflated => 8, #[cfg(feature = "deflate64")] CompressionMethod::Deflate64 => 9, @@ -173,11 +148,12 @@ impl Default for CompressionMethod { #[cfg(feature = "_deflate-any")] return CompressionMethod::Deflated; - #[cfg(all(not(any(feature = "_deflate-any")), feature = "bzip2"))] + #[cfg(all(not(feature = "_deflate-any"), feature = "bzip2"))] return CompressionMethod::Bzip2; #[cfg(all( - not(any(feature = "_deflate-any", feature = "bzip2")), + not(feature = "_deflate-any"), + not(feature = "bzip2"), feature = "zstd" ))] return CompressionMethod::Zstd; diff --git a/src/write.rs b/src/write.rs index d9e66e49..40e664ca 100644 --- a/src/write.rs +++ b/src/write.rs @@ -1299,12 +1299,7 @@ impl GenericZipWriter { Ok(Box::new(|bare| Storer(bare))) } } - #[cfg(any( - feature = "deflate", - feature = "deflate-zlib", - feature = "deflate-zlib-ng", - feature = "deflate-zopfli" - ))] + #[cfg(feature = "_deflate-any")] CompressionMethod::Deflated => { let default = if cfg!(feature = "deflate-zopfli") { 24