Use block-style for try_!.
				
					
				
			This commit is contained in:
		| @@ -75,8 +75,10 @@ impl Certificate { | |||||||
|     /// |     /// | ||||||
|     /// If the provided buffer is not valid DER, an error will be returned. |     /// If the provided buffer is not valid DER, an error will be returned. | ||||||
|     pub fn from_der(der: &[u8]) -> ::Result<Certificate> { |     pub fn from_der(der: &[u8]) -> ::Result<Certificate> { | ||||||
|         let inner = try_!(native_tls::Certificate::from_der(der) |         let inner = try_!( | ||||||
|                               .map_err(|e| ::hyper::Error::Ssl(Box::new(e)))); |             native_tls::Certificate::from_der(der) | ||||||
|  |                 .map_err(|e| ::hyper::Error::Ssl(Box::new(e))) | ||||||
|  |         ); | ||||||
|         Ok(Certificate(inner)) |         Ok(Certificate(inner)) | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -119,8 +121,10 @@ struct Config { | |||||||
| impl ClientBuilder { | impl ClientBuilder { | ||||||
|     /// Constructs a new `ClientBuilder` |     /// Constructs a new `ClientBuilder` | ||||||
|     pub fn new() -> ::Result<ClientBuilder> { |     pub fn new() -> ::Result<ClientBuilder> { | ||||||
|         let tls_connector_builder = try_!(native_tls::TlsConnector::builder() |         let tls_connector_builder = try_!( | ||||||
|                                               .map_err(|e| ::hyper::Error::Ssl(Box::new(e)))); |             native_tls::TlsConnector::builder() | ||||||
|  |                 .map_err(|e| ::hyper::Error::Ssl(Box::new(e))) | ||||||
|  |         ); | ||||||
|         Ok(ClientBuilder { |         Ok(ClientBuilder { | ||||||
|             config: Some(Config { |             config: Some(Config { | ||||||
|                 hostname_verification: true, |                 hostname_verification: true, | ||||||
| @@ -138,10 +142,12 @@ impl ClientBuilder { | |||||||
|     pub fn build(&mut self) -> ::Result<Client> { |     pub fn build(&mut self) -> ::Result<Client> { | ||||||
|         let config = self.take_config(); |         let config = self.take_config(); | ||||||
|  |  | ||||||
|         let tls_connector = try_!(config |         let tls_connector = try_!( | ||||||
|                                       .tls |             config | ||||||
|                                       .build() |                 .tls | ||||||
|                                       .map_err(|e| ::hyper::Error::Ssl(Box::new(e)))); |                 .build() | ||||||
|  |                 .map_err(|e| ::hyper::Error::Ssl(Box::new(e))) | ||||||
|  |         ); | ||||||
|         let mut tls_client = NativeTlsClient::from(tls_connector); |         let mut tls_client = NativeTlsClient::from(tls_connector); | ||||||
|         if !config.hostname_verification { |         if !config.hostname_verification { | ||||||
|             tls_client.danger_disable_hostname_verification(true); |             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 |     /// This can be used to connect to a server that has a self-signed | ||||||
|     /// certificate for example. |     /// certificate for example. | ||||||
|     pub fn add_root_certificate(&mut self, cert: Certificate) -> ::Result<&mut ClientBuilder> { |     pub fn add_root_certificate(&mut self, cert: Certificate) -> ::Result<&mut ClientBuilder> { | ||||||
|         try_!(self.config_mut() |         try_!( | ||||||
|                   .tls |             self.config_mut() | ||||||
|                   .add_root_certificate(cert.0) |                 .tls | ||||||
|                   .map_err(|e| ::hyper::Error::Ssl(Box::new(e)))); |                 .add_root_certificate(cert.0) | ||||||
|  |                 .map_err(|e| ::hyper::Error::Ssl(Box::new(e))) | ||||||
|  |         ); | ||||||
|         Ok(self) |         Ok(self) | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user