Check format to all rs files under src (#1188)
fixed-format of all missing files. Fixes seanmonstar/reqwest#1186
This commit is contained in:
21
src/tls.rs
21
src/tls.rs
@@ -22,10 +22,7 @@ enum Cert {
|
||||
|
||||
/// Represents a private key and X509 cert as a client certificate.
|
||||
pub struct Identity {
|
||||
#[cfg_attr(
|
||||
not(any(feature = "native-tls", feature = "__rustls")),
|
||||
allow(unused)
|
||||
)]
|
||||
#[cfg_attr(not(any(feature = "native-tls", feature = "__rustls")), allow(unused))]
|
||||
inner: ClientCert,
|
||||
}
|
||||
|
||||
@@ -159,7 +156,8 @@ impl Identity {
|
||||
pub fn from_pkcs12_der(der: &[u8], password: &str) -> crate::Result<Identity> {
|
||||
Ok(Identity {
|
||||
inner: ClientCert::Pkcs12(
|
||||
native_tls_crate::Identity::from_pkcs12(der, password).map_err(crate::error::builder)?,
|
||||
native_tls_crate::Identity::from_pkcs12(der, password)
|
||||
.map_err(crate::error::builder)?,
|
||||
),
|
||||
})
|
||||
}
|
||||
@@ -245,7 +243,8 @@ impl Identity {
|
||||
pub(crate) fn add_to_rustls(self, tls: &mut rustls::ClientConfig) -> crate::Result<()> {
|
||||
match self.inner {
|
||||
ClientCert::Pem { key, certs } => {
|
||||
tls.set_single_client_cert(certs, key).map_err(|e| crate::error::builder(e))?;
|
||||
tls.set_single_client_cert(certs, key)
|
||||
.map_err(|e| crate::error::builder(e))?;
|
||||
Ok(())
|
||||
}
|
||||
#[cfg(feature = "native-tls")]
|
||||
@@ -275,10 +274,7 @@ pub(crate) enum TlsBackend {
|
||||
Rustls,
|
||||
#[cfg(feature = "__rustls")]
|
||||
BuiltRustls(rustls::ClientConfig),
|
||||
#[cfg(any(
|
||||
feature = "native-tls",
|
||||
feature = "__rustls",
|
||||
))]
|
||||
#[cfg(any(feature = "native-tls", feature = "__rustls",))]
|
||||
UnknownPreconfigured,
|
||||
}
|
||||
|
||||
@@ -293,10 +289,7 @@ impl fmt::Debug for TlsBackend {
|
||||
TlsBackend::Rustls => write!(f, "Rustls"),
|
||||
#[cfg(feature = "__rustls")]
|
||||
TlsBackend::BuiltRustls(_) => write!(f, "BuiltRustls"),
|
||||
#[cfg(any(
|
||||
feature = "native-tls",
|
||||
feature = "__rustls",
|
||||
))]
|
||||
#[cfg(any(feature = "native-tls", feature = "__rustls",))]
|
||||
TlsBackend::UnknownPreconfigured => write!(f, "UnknownPreconfigured"),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user