Fix cfg for test

Fix up cfg attributes to work on an xor basis.

Previously, the cfg(any()) attributes would cause issues when
both native-tls and tls features were enabled. Now, https functions
and enum variants will only be created when tls xor native-tls are
enabled. Additionally, a compile error has been added for when
both tls and native-tls features are enabled.
This commit is contained in:
k3d3
2020-04-13 22:06:01 -04:00
committed by Martin Algesten
parent 9f7f712dde
commit de3416e260
4 changed files with 45 additions and 17 deletions

View File

@@ -181,6 +181,12 @@ pub fn patch(path: &str) -> Request {
request("PATCH", path)
}
// Compilation error when both tls and native-tls features are enabled
#[cfg(all(feature = "tls", feature = "native-tls"))]
std::compile_error!(
"You have both the \"tls\" and \"native-tls\" features enabled on ureq. Please disable one of these features."
);
#[cfg(test)]
mod tests {
use super::*;