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) { pub fn mark_request_as_sent(&self, request_id: &Uuid) {
self.outbound_sessions_being_shared if let Some((_, s)) = self.outbound_sessions_being_shared.remove(request_id) {
.remove(request_id) s.mark_request_as_sent(request_id);
.map(|(_, s)| s.mark_request_as_sent(request_id)); }
} }
/// Get an outbound group session for a room, if one exists. /// 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 /// This removes the request from the queue and marks the set of
/// users/devices that received the session. /// users/devices that received the session.
pub fn mark_request_as_sent(&self, request_id: &Uuid) { pub fn mark_request_as_sent(&self, request_id: &Uuid) {
let request = self.to_share_with_set.remove(request_id); if let Some((_, r)) = self.to_share_with_set.remove(request_id) {
request.map(|(_, r)| {
let user_pairs = r.messages.iter().map(|(u, v)| { let user_pairs = r.messages.iter().map(|(u, v)| {
( (
u.clone(), u.clone(),
@ -179,16 +177,16 @@ impl OutboundGroupSession {
.entry(u) .entry(u)
.or_insert_with(DashSet::new) .or_insert_with(DashSet::new)
.extend(d); .extend(d);
}) });
});
if self.to_share_with_set.is_empty() { if self.to_share_with_set.is_empty() {
debug!( debug!(
"Marking session {} for room {} as shared.", "Marking session {} for room {} as shared.",
self.session_id(), self.session_id(),
self.room_id self.room_id
); );
self.mark_as_shared(); self.mark_as_shared();
}
} }
} }