From 62e390e8141132321d548a37edc9640b2ff0adbe Mon Sep 17 00:00:00 2001 From: j-brn Date: Fri, 16 Oct 2020 22:05:42 +0200 Subject: [PATCH] awc: relace cfg attributes for HTTPS_ENCODING with cfg-if --- awc/src/request.rs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/awc/src/request.rs b/awc/src/request.rs index 1de53b3be..11e1da6a3 100644 --- a/awc/src/request.rs +++ b/awc/src/request.rs @@ -21,19 +21,15 @@ use crate::frozen::FrozenClientRequest; use crate::sender::{PrepForSendingError, RequestSender, SendClientRequest}; use crate::ClientConfig; -#[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] -const HTTPS_ENCODING: &str = "br, gzip, deflate"; -#[cfg(all( - not(any(feature = "flate2-zlib", feature = "flate2-rust")), - feature = "compress" -))] -const HTTPS_ENCODING: &str = "br"; -#[cfg(not(any( - feature = "flate2-zlib", - feature = "flate2-rust", - feature = "compress" -)))] -const HTTPS_ENCODING: &str = "identity"; +cfg_if::cfg_if! { + if #[cfg(any(feature = "flate2-zlib", feature = "flate2-rust"))] { + const HTTPS_ENCODING: &str = "br, gzip, deflate"; + } else if #[cfg(feature = "compress")] { + const HTTPS_ENCODING: &str = "br"; + } else { + const HTTPS_ENCODING: &str = "identity"; + } +} /// An HTTP Client request builder ///