@@ -14,7 +14,7 @@ use crate::{TlsAcceptorBuilder, TlsConnectorBuilder};
14
14
15
15
const SEC_E_NO_CREDENTIALS : u32 = 0x8009030E ;
16
16
17
- static PROTOCOLS : & ' static [ Protocol ] = & [
17
+ static PROTOCOLS : & [ Protocol ] = & [
18
18
Protocol :: Ssl3 ,
19
19
Protocol :: Tls10 ,
20
20
Protocol :: Tls11 ,
@@ -104,7 +104,7 @@ impl Identity {
104
104
}
105
105
106
106
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) ;
108
108
let leaf = cert_iter. next ( ) . ok_or_else ( || {
109
109
io:: Error :: new (
110
110
io:: ErrorKind :: InvalidInput ,
@@ -127,7 +127,7 @@ impl Identity {
127
127
Ok ( container) => container,
128
128
Err ( _) => options. new_keyset ( true ) . acquire ( type_) ?,
129
129
} ;
130
- container. import ( ) . import_pkcs8_pem ( & key) ?;
130
+ container. import ( ) . import_pkcs8_pem ( key) ?;
131
131
132
132
cert. set_key_prov_info ( )
133
133
. container ( & name)
@@ -205,6 +205,7 @@ impl<S> MidHandshakeTlsStream<S>
205
205
where
206
206
S : io:: Read + io:: Write ,
207
207
{
208
+ #[ allow( clippy:: result_large_err) ]
208
209
pub fn handshake ( self ) -> Result < TlsStream < S > , HandshakeError < S > > {
209
210
match self . 0 . handshake ( ) {
210
211
Ok ( s) => Ok ( TlsStream ( s) ) ,
@@ -213,6 +214,7 @@ where
213
214
}
214
215
}
215
216
217
+ #[ allow( clippy:: large_enum_variant) ]
216
218
pub enum HandshakeError < S > {
217
219
Failure ( Error ) ,
218
220
WouldBlock ( MidHandshakeTlsStream < S > ) ,
@@ -271,6 +273,7 @@ impl TlsConnector {
271
273
} )
272
274
}
273
275
276
+ #[ allow( clippy:: result_large_err) ]
274
277
pub fn connect < S > ( & self , domain : & str , stream : S ) -> Result < TlsStream < S > , HandshakeError < S > >
275
278
where
276
279
S : io:: Read + io:: Write ,
@@ -292,10 +295,8 @@ impl TlsConnector {
292
295
} else if self . disable_built_in_roots {
293
296
let roots_copy = self . roots . clone ( ) ;
294
297
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 ( ) ?;
299
300
300
301
if let Some ( chain) = res. chain ( ) {
301
302
if chain
@@ -306,8 +307,7 @@ impl TlsConnector {
306
307
}
307
308
}
308
309
309
- Err ( io:: Error :: new (
310
- io:: ErrorKind :: Other ,
310
+ Err ( io:: Error :: other (
311
311
"unable to find any user-specified roots in the final cert chain" ,
312
312
) )
313
313
} ) ;
@@ -343,6 +343,7 @@ impl TlsAcceptor {
343
343
} )
344
344
}
345
345
346
+ #[ allow( clippy:: result_large_err) ]
346
347
pub fn accept < S > ( & self , stream : S ) -> Result < TlsStream < S > , HandshakeError < S > >
347
348
where
348
349
S : io:: Read + io:: Write ,
@@ -472,7 +473,7 @@ mod pem {
472
473
Some ( end) => end + begin + 1 ,
473
474
None => last,
474
475
} ;
475
- return Some ( & self . pem_block [ begin..self . cur_end ] . as_bytes ( ) ) ;
476
+ Some ( & self . pem_block . as_bytes ( ) [ begin..self . cur_end ] )
476
477
}
477
478
}
478
479
0 commit comments