diff --git a/src/olm/session/mod.rs b/src/olm/session/mod.rs index bea69664..050867ba 100644 --- a/src/olm/session/mod.rs +++ b/src/olm/session/mod.rs @@ -312,13 +312,8 @@ impl Session { // message from the other side. Therefore we need to filter that chain // out when trying to determine whether we've ever received a message // from the other side. - let is_empty = self - .receiving_chains - .inner - .iter() - .filter(|c| !c.belongs_to(&initial_ratchet_key)) - .next() - .is_none(); + let is_empty = + self.receiving_chains.inner.iter().any(|c| !c.belongs_to(&initial_ratchet_key)); !is_empty } @@ -612,6 +607,7 @@ impl Session { impl TryFrom for Session { type Error = crate::LibolmPickleError; + #[allow(unreachable_code, clippy::diverging_sub_expression)] fn try_from(pickle: Pickle) -> Result { let mut receiving_chains = ChainStore::new(); @@ -628,13 +624,16 @@ impl Session { } } - let session_keys = SessionKeys { + let _session_keys = SessionKeys { identity_key: pickle.session_keys.identity_key, base_key: pickle.session_keys.base_key, signed_pre_key: pickle.session_keys.one_time_key, one_time_key: None, - other_identity_key: todo!("libolm session pickles don't contain this information, \ - so there's not enough information to reconstruct a `Session`"), + // TODO: Figure out what to do with libolm session pickles + other_identity_key: unimplemented!( + "libolm session pickles don't contain this information, \ + so there's not enough information to reconstruct a `Session`" + ), }; if let Some(chain) = pickle.sender_chains.first() { @@ -654,7 +653,7 @@ impl Session { DoubleRatchet::from_ratchet_and_chain_key(ratchet, chain_key); Ok(Self { - session_keys, + session_keys: _session_keys, sending_ratchet, receiving_chains, config: SessionConfig::version_1(), @@ -668,7 +667,7 @@ impl Session { ); Ok(Self { - session_keys, + session_keys: _session_keys, sending_ratchet, receiving_chains, config: SessionConfig::version_1(),