@@ -14,7 +14,7 @@ use crate::{TlsAcceptorBuilder, TlsConnectorBuilder};
1414
1515const SEC_E_NO_CREDENTIALS : u32 = 0x8009030E ;
1616
17- static PROTOCOLS : & ' static [ Protocol ] = & [
17+ static PROTOCOLS : & [ Protocol ] = & [
1818 Protocol :: Ssl3 ,
1919 Protocol :: Tls10 ,
2020 Protocol :: Tls11 ,
@@ -104,7 +104,7 @@ impl Identity {
104104 }
105105
106106 let mut store = Memory :: new ( ) ?. into_store ( ) ;
107- let mut cert_iter = pem:: PemBlock :: new ( pem) . into_iter ( ) ;
107+ let mut cert_iter = pem:: PemBlock :: new ( pem) ;
108108 let leaf = cert_iter. next ( ) . ok_or_else ( || {
109109 io:: Error :: new (
110110 io:: ErrorKind :: InvalidInput ,
@@ -127,7 +127,7 @@ impl Identity {
127127 Ok ( container) => container,
128128 Err ( _) => options. new_keyset ( true ) . acquire ( type_) ?,
129129 } ;
130- container. import ( ) . import_pkcs8_pem ( & key) ?;
130+ container. import ( ) . import_pkcs8_pem ( key) ?;
131131
132132 cert. set_key_prov_info ( )
133133 . container ( & name)
@@ -205,6 +205,7 @@ impl<S> MidHandshakeTlsStream<S>
205205where
206206 S : io:: Read + io:: Write ,
207207{
208+ #[ allow( clippy:: result_large_err) ]
208209 pub fn handshake ( self ) -> Result < TlsStream < S > , HandshakeError < S > > {
209210 match self . 0 . handshake ( ) {
210211 Ok ( s) => Ok ( TlsStream ( s) ) ,
@@ -213,6 +214,7 @@ where
213214 }
214215}
215216
217+ #[ allow( clippy:: large_enum_variant) ]
216218pub enum HandshakeError < S > {
217219 Failure ( Error ) ,
218220 WouldBlock ( MidHandshakeTlsStream < S > ) ,
@@ -271,6 +273,7 @@ impl TlsConnector {
271273 } )
272274 }
273275
276+ #[ allow( clippy:: result_large_err) ]
274277 pub fn connect < S > ( & self , domain : & str , stream : S ) -> Result < TlsStream < S > , HandshakeError < S > >
275278 where
276279 S : io:: Read + io:: Write ,
@@ -292,10 +295,8 @@ impl TlsConnector {
292295 } else if self . disable_built_in_roots {
293296 let roots_copy = self . roots . clone ( ) ;
294297 builder. verify_callback ( move |res| {
295- if let Err ( err) = res. result ( ) {
296- // Propagate previous error encountered during normal cert validation.
297- return Err ( err) ;
298- }
298+ // Propagate previous error encountered during normal cert validation.
299+ res. result ( ) ?;
299300
300301 if let Some ( chain) = res. chain ( ) {
301302 if chain
@@ -306,8 +307,7 @@ impl TlsConnector {
306307 }
307308 }
308309
309- Err ( io:: Error :: new (
310- io:: ErrorKind :: Other ,
310+ Err ( io:: Error :: other (
311311 "unable to find any user-specified roots in the final cert chain" ,
312312 ) )
313313 } ) ;
@@ -343,6 +343,7 @@ impl TlsAcceptor {
343343 } )
344344 }
345345
346+ #[ allow( clippy:: result_large_err) ]
346347 pub fn accept < S > ( & self , stream : S ) -> Result < TlsStream < S > , HandshakeError < S > >
347348 where
348349 S : io:: Read + io:: Write ,
@@ -472,7 +473,7 @@ mod pem {
472473 Some ( end) => end + begin + 1 ,
473474 None => last,
474475 } ;
475- return Some ( & self . pem_block [ begin..self . cur_end ] . as_bytes ( ) ) ;
476+ Some ( & self . pem_block . as_bytes ( ) [ begin..self . cur_end ] )
476477 }
477478 }
478479
0 commit comments