From 0bd438e61785ee8a64289cb443327e9ee6e738f1 Mon Sep 17 00:00:00 2001 From: stoically Date: Thu, 5 Aug 2021 22:48:05 +0200 Subject: [PATCH] Fix clippy warnings --- matrix_sdk/src/client.rs | 2 +- matrix_sdk/src/room/joined.rs | 4 ++-- matrix_sdk_crypto/src/verification/machine.rs | 2 +- matrix_sdk_crypto/src/verification/mod.rs | 2 +- matrix_sdk_crypto/src/verification/requests.rs | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/matrix_sdk/src/client.rs b/matrix_sdk/src/client.rs index ee5a4fbe..45ddb9e9 100644 --- a/matrix_sdk/src/client.rs +++ b/matrix_sdk/src/client.rs @@ -963,7 +963,7 @@ impl Client { let event = event.clone().into(); if let AnySyncMessageEvent::RoomEncrypted(e) = event { - if let Ok(decrypted) = machine.decrypt_room_event(&e, &room_id).await { + if let Ok(decrypted) = machine.decrypt_room_event(&e, room_id).await { let event = decrypted .event .deserialize() diff --git a/matrix_sdk/src/room/joined.rs b/matrix_sdk/src/room/joined.rs index 2d5be644..04d56a20 100644 --- a/matrix_sdk/src/room/joined.rs +++ b/matrix_sdk/src/room/joined.rs @@ -461,9 +461,9 @@ impl Joined { #[cfg(feature = "encryption")] let mut reader = AttachmentEncryptor::new(reader); #[cfg(feature = "encryption")] - let content_type = mime::APPLICATION_OCTET_STREAM; + let content_type = &mime::APPLICATION_OCTET_STREAM; - let response = self.client.upload(&content_type, &mut reader).await?; + let response = self.client.upload(content_type, &mut reader).await?; #[cfg(feature = "encryption")] let keys: Option> = { diff --git a/matrix_sdk_crypto/src/verification/machine.rs b/matrix_sdk_crypto/src/verification/machine.rs index fbab484f..af18ba11 100644 --- a/matrix_sdk_crypto/src/verification/machine.rs +++ b/matrix_sdk_crypto/src/verification/machine.rs @@ -484,7 +484,7 @@ impl VerificationMachine { } } Some(Verification::QrV1(qr)) => { - let (cancellation, request) = qr.receive_done(&c).await?; + let (cancellation, request) = qr.receive_done(c).await?; if let Some(c) = cancellation { self.verifications.add_request(c.into()) diff --git a/matrix_sdk_crypto/src/verification/mod.rs b/matrix_sdk_crypto/src/verification/mod.rs index 20ed6105..ee89552d 100644 --- a/matrix_sdk_crypto/src/verification/mod.rs +++ b/matrix_sdk_crypto/src/verification/mod.rs @@ -177,7 +177,7 @@ pub struct CancelInfo { impl CancelInfo { /// Get the human readable reason of the cancellation. pub fn reason(&self) -> &'static str { - &self.reason + self.reason } /// Get the `CancelCode` that cancelled this verification. diff --git a/matrix_sdk_crypto/src/verification/requests.rs b/matrix_sdk_crypto/src/verification/requests.rs index f20d6d15..c41b1a5e 100644 --- a/matrix_sdk_crypto/src/verification/requests.rs +++ b/matrix_sdk_crypto/src/verification/requests.rs @@ -389,7 +389,7 @@ impl VerificationRequest { inner.accept(methods).map(|c| match c { OutgoingContent::ToDevice(content) => { - ToDeviceRequest::new(&self.other_user(), inner.other_device_id(), content).into() + ToDeviceRequest::new(self.other_user(), inner.other_device_id(), content).into() } OutgoingContent::Room(room_id, content) => { RoomMessageRequest { room_id, txn_id: Uuid::new_v4(), content }.into() @@ -433,14 +433,14 @@ impl VerificationRequest { OutgoingContent::ToDevice(content) => { if send_to_everyone { ToDeviceRequest::new_for_recipients( - &self.other_user(), + self.other_user(), self.recipient_devices.to_vec(), content, Uuid::new_v4(), ) .into() } else { - ToDeviceRequest::new(&self.other_user(), other_device, content).into() + ToDeviceRequest::new(self.other_user(), other_device, content).into() } } OutgoingContent::Room(room_id, content) => { @@ -621,7 +621,7 @@ impl VerificationRequest { let request = match content { OutgoingContent::ToDevice(content) => ToDeviceRequest::new( - &self.other_user(), + self.other_user(), inner.other_device_id(), content, )