@@ -312,13 +312,8 @@ impl Session {
312312 // message from the other side. Therefore we need to filter that chain
313313 // out when trying to determine whether we've ever received a message
314314 // from the other side.
315- let is_empty = self
316- . receiving_chains
317- . inner
318- . iter ( )
319- . filter ( |c| !c. belongs_to ( & initial_ratchet_key) )
320- . next ( )
321- . is_none ( ) ;
315+ let is_empty =
316+ self . receiving_chains . inner . iter ( ) . any ( |c| !c. belongs_to ( & initial_ratchet_key) ) ;
322317
323318 !is_empty
324319 }
@@ -612,6 +607,7 @@ impl Session {
612607 impl TryFrom < Pickle > for Session {
613608 type Error = crate :: LibolmPickleError ;
614609
610+ #[ allow( unreachable_code, clippy:: diverging_sub_expression) ]
615611 fn try_from ( pickle : Pickle ) -> Result < Self , Self :: Error > {
616612 let mut receiving_chains = ChainStore :: new ( ) ;
617613
@@ -628,13 +624,16 @@ impl Session {
628624 }
629625 }
630626
631- let session_keys = SessionKeys {
627+ let _session_keys = SessionKeys {
632628 identity_key : pickle. session_keys . identity_key ,
633629 base_key : pickle. session_keys . base_key ,
634630 signed_pre_key : pickle. session_keys . one_time_key ,
635631 one_time_key : None ,
636- other_identity_key : todo ! ( "libolm session pickles don't contain this information, \
637- so there's not enough information to reconstruct a `Session`") ,
632+ // TODO: Figure out what to do with libolm session pickles
633+ other_identity_key : unimplemented ! (
634+ "libolm session pickles don't contain this information, \
635+ so there's not enough information to reconstruct a `Session`"
636+ ) ,
638637 } ;
639638
640639 if let Some ( chain) = pickle. sender_chains . first ( ) {
@@ -654,7 +653,7 @@ impl Session {
654653 DoubleRatchet :: from_ratchet_and_chain_key ( ratchet, chain_key) ;
655654
656655 Ok ( Self {
657- session_keys,
656+ session_keys : _session_keys ,
658657 sending_ratchet,
659658 receiving_chains,
660659 config : SessionConfig :: version_1 ( ) ,
@@ -668,7 +667,7 @@ impl Session {
668667 ) ;
669668
670669 Ok ( Self {
671- session_keys,
670+ session_keys : _session_keys ,
672671 sending_ratchet,
673672 receiving_chains,
674673 config : SessionConfig :: version_1 ( ) ,
@@ -794,7 +793,7 @@ mod test {
794793 bob. generate_one_time_keys ( 2 ) ;
795794
796795 let mut bob_prekeys: Vec < ( KeyId , Curve25519PublicKey ) > =
797- bob. one_time_keys ( ) . iter ( ) . map ( |( t1, t2) | ( t1 . clone ( ) , t2 . clone ( ) ) ) . take ( 2 ) . collect ( ) ;
796+ bob. one_time_keys ( ) . iter ( ) . map ( |( t1, t2) | ( * t1 , * t2 ) ) . take ( 2 ) . collect ( ) ;
798797 let ( otk_id, otk) =
799798 bob_prekeys. pop ( ) . expect ( "Bob should have an OTK because we just generated it" ) ;
800799 let ( skey_id, skey) = bob_prekeys
@@ -817,10 +816,8 @@ mod test {
817816 let ciphertext = alice_session. encrypt_interolm ( message) ;
818817
819818 if let AnyMessage :: Interolm ( AnyInterolmMessage :: PreKey ( m) ) = ciphertext. into ( ) {
820- let InboundCreationResult { session, .. } = bob. create_inbound_session (
821- alice. identity_keys ( ) . curve25519 ,
822- & m. try_into ( ) . expect ( "We should be able to establish the session" ) ,
823- ) ?;
819+ let InboundCreationResult { session, .. } =
820+ bob. create_inbound_session ( alice. identity_keys ( ) . curve25519 , & m. into ( ) ) ?;
824821
825822 Ok ( ( alice, bob, alice_session, session) )
826823 } else {
0 commit comments