@@ -318,7 +318,7 @@ impl Session for NoiseSession {
318318 }
319319 let ( remote_s, rest) = rest. split_at ( 32 ) ;
320320 let mut s = [ 0 ; 32 ] ;
321- self . xoodyak . decrypt ( & remote_s, & mut s) ;
321+ self . xoodyak . decrypt ( remote_s, & mut s) ;
322322 let s = PublicKey :: from_bytes ( & s)
323323 . map_err ( |_| connection_refused ( "invalid static public key" ) ) ?;
324324 self . remote_s = Some ( s) ;
@@ -343,9 +343,8 @@ impl Session for NoiseSession {
343343 . supported_protocols
344344 . as_ref ( )
345345 . 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) ;
349348 if !is_supported {
350349 return Err ( connection_refused ( "unsupported alpn" ) ) ;
351350 }
@@ -356,11 +355,11 @@ impl Session for NoiseSession {
356355 }
357356 let ( params, auth) = rest. split_at ( rest. len ( ) - 16 ) ;
358357 let mut transport_parameters = vec ! [ 0 ; params. len( ) ] ;
359- self . xoodyak . decrypt ( & params, & mut transport_parameters) ;
358+ self . xoodyak . decrypt ( params, & mut transport_parameters) ;
360359 // check tag
361360 let mut tag = [ 0 ; 16 ] ;
362361 self . xoodyak . squeeze ( & mut tag) ;
363- if !bool:: from ( tag. ct_eq ( & auth) ) {
362+ if !bool:: from ( tag. ct_eq ( auth) ) {
364363 return Err ( connection_refused ( "invalid authentication tag" ) ) ;
365364 }
366365 self . remote_transport_parameters = Some ( TransportParameters :: read (
@@ -377,7 +376,7 @@ impl Session for NoiseSession {
377376 }
378377 let ( remote_e, rest) = handshake. split_at ( 32 ) ;
379378 let mut e = [ 0 ; 32 ] ;
380- self . xoodyak . decrypt ( & remote_e, & mut e) ;
379+ self . xoodyak . decrypt ( remote_e, & mut e) ;
381380 let e = PublicKey :: from_bytes ( & e)
382381 . map_err ( |_| connection_refused ( "invalid ephemeral public key" ) ) ?;
383382 self . remote_e = Some ( e) ;
@@ -393,11 +392,11 @@ impl Session for NoiseSession {
393392 }
394393 let ( params, auth) = rest. split_at ( rest. len ( ) - 16 ) ;
395394 let mut transport_parameters = vec ! [ 0 ; params. len( ) ] ;
396- self . xoodyak . decrypt ( & params, & mut transport_parameters) ;
395+ self . xoodyak . decrypt ( params, & mut transport_parameters) ;
397396 // check tag
398397 let mut tag = [ 0 ; 16 ] ;
399398 self . xoodyak . squeeze ( & mut tag) ;
400- if !bool:: from ( tag. ct_eq ( & auth) ) {
399+ if !bool:: from ( tag. ct_eq ( auth) ) {
401400 return Err ( connection_refused ( "invalid authentication tag" ) ) ;
402401 }
403402 self . remote_transport_parameters = Some ( TransportParameters :: read (
0 commit comments