refactor: Eliminate deprecation warning when --all-features
implicitly enables the deprecated feature
This commit is contained in:
parent
fbf111ef97
commit
1cb0e1b3b7
3 changed files with 13 additions and 11 deletions
|
@ -63,6 +63,7 @@ tempdir = "0.3.7"
|
||||||
aes-crypto = ["aes", "constant_time_eq", "hmac", "pbkdf2", "sha1", "rand", "zeroize"]
|
aes-crypto = ["aes", "constant_time_eq", "hmac", "pbkdf2", "sha1", "rand", "zeroize"]
|
||||||
chrono = ["chrono/default"]
|
chrono = ["chrono/default"]
|
||||||
_deflate-any = []
|
_deflate-any = []
|
||||||
|
_all-features = [] # Detect when --all-features is used
|
||||||
deflate = ["flate2/rust_backend", "_deflate-any"]
|
deflate = ["flate2/rust_backend", "_deflate-any"]
|
||||||
|
|
||||||
# DEPRECATED: previously enabled `flate2/miniz_oxide` which is equivalent to `flate2/rust_backend`
|
# DEPRECATED: previously enabled `flate2/miniz_oxide` which is equivalent to `flate2/rust_backend`
|
||||||
|
|
|
@ -25,8 +25,8 @@ struct Args {
|
||||||
enum CompressionMethod {
|
enum CompressionMethod {
|
||||||
Stored,
|
Stored,
|
||||||
Deflated,
|
Deflated,
|
||||||
DeflatedMiniz,
|
|
||||||
DeflatedZlib,
|
DeflatedZlib,
|
||||||
|
DeflatedZlibNg,
|
||||||
Bzip2,
|
Bzip2,
|
||||||
Zstd,
|
Zstd,
|
||||||
}
|
}
|
||||||
|
@ -50,15 +50,6 @@ fn real_main() -> i32 {
|
||||||
#[cfg(feature = "deflate")]
|
#[cfg(feature = "deflate")]
|
||||||
zip::CompressionMethod::Deflated
|
zip::CompressionMethod::Deflated
|
||||||
}
|
}
|
||||||
CompressionMethod::DeflatedMiniz => {
|
|
||||||
#[cfg(not(feature = "deflate-miniz"))]
|
|
||||||
{
|
|
||||||
println!("The `deflate-miniz` feature is not enabled");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#[cfg(feature = "deflate-miniz")]
|
|
||||||
zip::CompressionMethod::Deflated
|
|
||||||
}
|
|
||||||
CompressionMethod::DeflatedZlib => {
|
CompressionMethod::DeflatedZlib => {
|
||||||
#[cfg(not(feature = "deflate-zlib"))]
|
#[cfg(not(feature = "deflate-zlib"))]
|
||||||
{
|
{
|
||||||
|
@ -68,6 +59,15 @@ fn real_main() -> i32 {
|
||||||
#[cfg(feature = "deflate-zlib")]
|
#[cfg(feature = "deflate-zlib")]
|
||||||
zip::CompressionMethod::Deflated
|
zip::CompressionMethod::Deflated
|
||||||
}
|
}
|
||||||
|
CompressionMethod::DeflatedZlibNg => {
|
||||||
|
#[cfg(not(feature = "deflate-zlib-ng"))]
|
||||||
|
{
|
||||||
|
println!("The `deflate-zlib-ng` feature is not enabled");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#[cfg(feature = "deflate-zlib-ng")]
|
||||||
|
zip::CompressionMethod::Deflated
|
||||||
|
}
|
||||||
CompressionMethod::Bzip2 => {
|
CompressionMethod::Bzip2 => {
|
||||||
#[cfg(not(feature = "bzip2"))]
|
#[cfg(not(feature = "bzip2"))]
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use std::env::var;
|
use std::env::var;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
if var("CARGO_FEATURE_DEFLATE_MINIZ").is_ok() {
|
if var("CARGO_FEATURE_DEFLATE_MINIZ").is_ok()
|
||||||
|
&& var("CARGO_FEATURE__ALL_FEATURES").is_err() {
|
||||||
println!("cargo:warning=Feature `deflate-miniz` is deprecated; replace it with `deflate`");
|
println!("cargo:warning=Feature `deflate-miniz` is deprecated; replace it with `deflate`");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue