Skip to content

Commit

Permalink
chore: Appease clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
dkasak committed Feb 4, 2024
1 parent 5bb393b commit 1d216b5
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/olm/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -612,6 +607,7 @@ impl Session {
impl TryFrom<Pickle> for Session {
type Error = crate::LibolmPickleError;

#[allow(unreachable_code, clippy::diverging_sub_expression)]
fn try_from(pickle: Pickle) -> Result<Self, Self::Error> {
let mut receiving_chains = ChainStore::new();

Expand All @@ -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() {
Expand All @@ -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(),
Expand All @@ -668,7 +667,7 @@ impl Session {
);

Ok(Self {
session_keys,
session_keys: _session_keys,
sending_ratchet,
receiving_chains,
config: SessionConfig::version_1(),
Expand Down

0 comments on commit 1d216b5

Please sign in to comment.