tls: use rustls if both native-tls and rustls-tls are enabled (#586)

Co-authored-by: Alexis Mousset <contact@amousset.me>
This commit is contained in:
Paolo Barbolini
2021-03-30 11:06:26 +02:00
committed by GitHub
parent 1193e1134d
commit 2002a9d75a

View File

@@ -128,18 +128,12 @@ impl TlsParametersBuilder {
/// depending on which one is available
#[cfg(any(feature = "native-tls", feature = "rustls-tls"))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "native-tls", feature = "rustls-tls"))))]
// TODO: remove below line once native-tls is supported with async-std
#[allow(unreachable_code)]
pub fn build(self) -> Result<TlsParameters, Error> {
// TODO: remove once native-tls is supported with async-std
#[cfg(all(feature = "rustls-tls", feature = "async-std1"))]
#[cfg(feature = "rustls-tls")]
return self.build_rustls();
#[cfg(feature = "native-tls")]
#[cfg(not(feature = "rustls-tls"))]
return self.build_native();
#[cfg(not(feature = "native-tls"))]
return self.build_rustls();
}
/// Creates a new `TlsParameters` using native-tls with the provided configuration