From e48d4ef1d133376fff1fb7206be65441260e3013 Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Sun, 28 Apr 2024 10:43:36 -0700 Subject: [PATCH 1/2] revert: refactor!: remove `deflate-miniz` feature since it's now equivalent to `deflate` (#35)" Reverts: 16633213 --- Cargo.toml | 4 ++++ README.md | 4 ++++ src/compression.rs | 40 ++++++++-------------------------------- src/write.rs | 7 +------ 4 files changed, 17 insertions(+), 38 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b2cb4efb..0adfa1f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 From 12b988b824fcfec786e3d4e4be8cb99ab8815718 Mon Sep 17 00:00:00 2001 From: Chris Hennick <4961925+Pr0methean@users.noreply.github.com> Date: Sun, 28 Apr 2024 10:50:33 -0700 Subject: [PATCH 2/2] chore: override version number to 1.1.2 since the breaking change was reverted --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0adfa1f9..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 ",