revert: refactor!: remove deflate-miniz feature since it's now equivalent to deflate (#35)"

Reverts: 16633213
This commit is contained in:
Chris Hennick 2024-04-28 10:43:36 -07:00
parent e32ab41c3b
commit e48d4ef1d1
No known key found for this signature in database
GPG key ID: DA47AABA4961C509
4 changed files with 17 additions and 38 deletions

View file

@ -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"]

View file

@ -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
----

View file

@ -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;

View file

@ -1299,12 +1299,7 @@ impl<W: Write + Seek> GenericZipWriter<W> {
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