crypto: Fix some clippy warnings.

master
Damir Jelić 2020-08-03 15:05:19 +02:00
parent a3bb8a0d74
commit e431ba0bf5
2 changed files with 6 additions and 9 deletions

View File

@ -138,11 +138,10 @@ impl VerificationMachine {
AnyToDeviceEvent::KeyVerificationMac(e) => { AnyToDeviceEvent::KeyVerificationMac(e) => {
if let Some(s) = self.get_sas(&e.content.transaction_id) { if let Some(s) = self.get_sas(&e.content.transaction_id) {
self.receive_event_helper(&s, event); self.receive_event_helper(&s, event);
if s.is_done() {
if !s.mark_device_as_verified().await? { if s.is_done() && !s.mark_device_as_verified().await? {
if let Some(r) = s.cancel() { if let Some(r) = s.cancel() {
self.outgoing_to_device_messages.insert(r.txn_id.clone(), r); self.outgoing_to_device_messages.insert(r.txn_id.clone(), r);
}
} }
} }
}; };

View File

@ -162,10 +162,8 @@ impl Sas {
(content, guard.is_done()) (content, guard.is_done())
}; };
if done { if done && !self.mark_device_as_verified().await? {
if !self.mark_device_as_verified().await? { return Ok(self.cancel());
return Ok(self.cancel());
}
} }
Ok(content.map(|c| { Ok(content.map(|c| {