diff --git a/src/client.rs b/src/client.rs index aca6e47..4dc260e 100644 --- a/src/client.rs +++ b/src/client.rs @@ -75,8 +75,10 @@ impl Certificate { /// /// If the provided buffer is not valid DER, an error will be returned. pub fn from_der(der: &[u8]) -> ::Result { - let inner = try_!(native_tls::Certificate::from_der(der) - .map_err(|e| ::hyper::Error::Ssl(Box::new(e)))); + let inner = try_!( + native_tls::Certificate::from_der(der) + .map_err(|e| ::hyper::Error::Ssl(Box::new(e))) + ); Ok(Certificate(inner)) } } @@ -119,8 +121,10 @@ struct Config { impl ClientBuilder { /// Constructs a new `ClientBuilder` pub fn new() -> ::Result { - let tls_connector_builder = try_!(native_tls::TlsConnector::builder() - .map_err(|e| ::hyper::Error::Ssl(Box::new(e)))); + let tls_connector_builder = try_!( + native_tls::TlsConnector::builder() + .map_err(|e| ::hyper::Error::Ssl(Box::new(e))) + ); Ok(ClientBuilder { config: Some(Config { hostname_verification: true, @@ -138,10 +142,12 @@ impl ClientBuilder { pub fn build(&mut self) -> ::Result { let config = self.take_config(); - let tls_connector = try_!(config - .tls - .build() - .map_err(|e| ::hyper::Error::Ssl(Box::new(e)))); + let tls_connector = try_!( + config + .tls + .build() + .map_err(|e| ::hyper::Error::Ssl(Box::new(e))) + ); let mut tls_client = NativeTlsClient::from(tls_connector); if !config.hostname_verification { tls_client.danger_disable_hostname_verification(true); @@ -171,10 +177,12 @@ impl ClientBuilder { /// This can be used to connect to a server that has a self-signed /// certificate for example. pub fn add_root_certificate(&mut self, cert: Certificate) -> ::Result<&mut ClientBuilder> { - try_!(self.config_mut() - .tls - .add_root_certificate(cert.0) - .map_err(|e| ::hyper::Error::Ssl(Box::new(e)))); + try_!( + self.config_mut() + .tls + .add_root_certificate(cert.0) + .map_err(|e| ::hyper::Error::Ssl(Box::new(e))) + ); Ok(self) }