crypto: Fix some clippy warnings

This commit is contained in:
Damir Jelić 2021-06-04 18:49:08 +02:00
parent 7cca358399
commit 0df782e93e
3 changed files with 7 additions and 7 deletions

View file

@ -35,6 +35,7 @@ impl VerificationCache {
}
#[cfg(test)]
#[allow(dead_code)]
pub fn is_empty(&self) -> bool {
self.verification.is_empty()
}

View file

@ -371,7 +371,7 @@ mod test {
);
machine
.receive_any_event(&wrap_any_to_device_content(bob_sas.user_id(), start_content.into()))
.receive_any_event(&wrap_any_to_device_content(bob_sas.user_id(), start_content))
.await
.unwrap();
@ -405,8 +405,7 @@ mod test {
alice_machine.receive_any_event(&event).await.unwrap();
assert!(!alice_machine.verifications.outgoing_requests().is_empty());
let request =
alice_machine.verifications.outgoing_requests().iter().next().unwrap().clone();
let request = alice_machine.verifications.outgoing_requests().get(0).cloned().unwrap();
let txn_id = *request.request_id();
let content = OutgoingContent::try_from(request).unwrap();
let content = KeyContent::try_from(&content).unwrap().into();

View file

@ -248,14 +248,14 @@ impl VerificationRequest {
pub(crate) fn receive_done(&self, sender: &UserId, content: &DoneContent<'_>) {
if sender == self.other_user() {
let mut inner = self.inner.lock().unwrap().clone();
inner.into_done(content);
inner.receive_done(content);
}
}
pub(crate) fn receive_cancel(&self, sender: &UserId, content: &CancelContent<'_>) {
if sender == self.other_user() {
let mut inner = self.inner.lock().unwrap().clone();
inner.into_canceled(content.cancel_code());
inner.cancel(content.cancel_code());
}
}
@ -336,7 +336,7 @@ impl InnerRequest {
}
}
fn into_done(&mut self, content: &DoneContent) {
fn receive_done(&mut self, content: &DoneContent) {
*self = InnerRequest::Done(match self {
InnerRequest::Created(s) => s.clone().into_done(content),
InnerRequest::Requested(s) => s.clone().into_done(content),
@ -347,7 +347,7 @@ impl InnerRequest {
})
}
fn into_canceled(&mut self, cancel_code: &CancelCode) {
fn cancel(&mut self, cancel_code: &CancelCode) {
*self = InnerRequest::Cancelled(match self {
InnerRequest::Created(s) => s.clone().into_canceled(cancel_code),
InnerRequest::Requested(s) => s.clone().into_canceled(cancel_code),