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,13 +138,12 @@ impl VerificationMachine {
AnyToDeviceEvent::KeyVerificationMac(e) => {
if let Some(s) = self.get_sas(&e.content.transaction_id) {
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() {
self.outgoing_to_device_messages.insert(r.txn_id.clone(), r);
}
}
}
};
}
_ => (),

View File

@ -162,11 +162,9 @@ impl Sas {
(content, guard.is_done())
};
if done {
if !self.mark_device_as_verified().await? {
if done && !self.mark_device_as_verified().await? {
return Ok(self.cancel());
}
}
Ok(content.map(|c| {
let content = AnyToDeviceEventContent::KeyVerificationMac(c);