crypto: Fix some clippy warnings.

master
Damir Jelić 2020-10-01 16:45:13 +02:00
parent 02c765f903
commit e3d24f5c31
2 changed files with 13 additions and 15 deletions

View File

@ -59,9 +59,9 @@ impl GroupSessionManager {
}
pub fn mark_request_as_sent(&self, request_id: &Uuid) {
self.outbound_sessions_being_shared
.remove(request_id)
.map(|(_, s)| s.mark_request_as_sent(request_id));
if let Some((_, s)) = self.outbound_sessions_being_shared.remove(request_id) {
s.mark_request_as_sent(request_id);
}
}
/// Get an outbound group session for a room, if one exists.

View File

@ -158,9 +158,7 @@ impl OutboundGroupSession {
/// This removes the request from the queue and marks the set of
/// users/devices that received the session.
pub fn mark_request_as_sent(&self, request_id: &Uuid) {
let request = self.to_share_with_set.remove(request_id);
request.map(|(_, r)| {
if let Some((_, r)) = self.to_share_with_set.remove(request_id) {
let user_pairs = r.messages.iter().map(|(u, v)| {
(
u.clone(),
@ -179,7 +177,6 @@ impl OutboundGroupSession {
.entry(u)
.or_insert_with(DashSet::new)
.extend(d);
})
});
if self.to_share_with_set.is_empty() {
@ -191,6 +188,7 @@ impl OutboundGroupSession {
self.mark_as_shared();
}
}
}
/// Encrypt the given plaintext using this session.
///