@@ -318,7 +318,7 @@ impl Session for NoiseSession {
318
318
}
319
319
let ( remote_s, rest) = rest. split_at ( 32 ) ;
320
320
let mut s = [ 0 ; 32 ] ;
321
- self . xoodyak . decrypt ( & remote_s, & mut s) ;
321
+ self . xoodyak . decrypt ( remote_s, & mut s) ;
322
322
let s = PublicKey :: from_bytes ( & s)
323
323
. map_err ( |_| connection_refused ( "invalid static public key" ) ) ?;
324
324
self . remote_s = Some ( s) ;
@@ -343,9 +343,8 @@ impl Session for NoiseSession {
343
343
. supported_protocols
344
344
. as_ref ( )
345
345
. expect ( "invalid config" )
346
- . into_iter ( )
347
- . find ( |proto| proto. as_slice ( ) == alpn)
348
- . is_some ( ) ;
346
+ . iter ( )
347
+ . any ( |proto| proto. as_slice ( ) == alpn) ;
349
348
if !is_supported {
350
349
return Err ( connection_refused ( "unsupported alpn" ) ) ;
351
350
}
@@ -356,11 +355,11 @@ impl Session for NoiseSession {
356
355
}
357
356
let ( params, auth) = rest. split_at ( rest. len ( ) - 16 ) ;
358
357
let mut transport_parameters = vec ! [ 0 ; params. len( ) ] ;
359
- self . xoodyak . decrypt ( & params, & mut transport_parameters) ;
358
+ self . xoodyak . decrypt ( params, & mut transport_parameters) ;
360
359
// check tag
361
360
let mut tag = [ 0 ; 16 ] ;
362
361
self . xoodyak . squeeze ( & mut tag) ;
363
- if !bool:: from ( tag. ct_eq ( & auth) ) {
362
+ if !bool:: from ( tag. ct_eq ( auth) ) {
364
363
return Err ( connection_refused ( "invalid authentication tag" ) ) ;
365
364
}
366
365
self . remote_transport_parameters = Some ( TransportParameters :: read (
@@ -377,7 +376,7 @@ impl Session for NoiseSession {
377
376
}
378
377
let ( remote_e, rest) = handshake. split_at ( 32 ) ;
379
378
let mut e = [ 0 ; 32 ] ;
380
- self . xoodyak . decrypt ( & remote_e, & mut e) ;
379
+ self . xoodyak . decrypt ( remote_e, & mut e) ;
381
380
let e = PublicKey :: from_bytes ( & e)
382
381
. map_err ( |_| connection_refused ( "invalid ephemeral public key" ) ) ?;
383
382
self . remote_e = Some ( e) ;
@@ -393,11 +392,11 @@ impl Session for NoiseSession {
393
392
}
394
393
let ( params, auth) = rest. split_at ( rest. len ( ) - 16 ) ;
395
394
let mut transport_parameters = vec ! [ 0 ; params. len( ) ] ;
396
- self . xoodyak . decrypt ( & params, & mut transport_parameters) ;
395
+ self . xoodyak . decrypt ( params, & mut transport_parameters) ;
397
396
// check tag
398
397
let mut tag = [ 0 ; 16 ] ;
399
398
self . xoodyak . squeeze ( & mut tag) ;
400
- if !bool:: from ( tag. ct_eq ( & auth) ) {
399
+ if !bool:: from ( tag. ct_eq ( auth) ) {
401
400
return Err ( connection_refused ( "invalid authentication tag" ) ) ;
402
401
}
403
402
self . remote_transport_parameters = Some ( TransportParameters :: read (
0 commit comments