matrix-sdk: Fix some new clippy warnings

master
Damir Jelić 2021-02-12 12:59:53 +01:00
parent 2e7f862f9c
commit 2811c490a0
3 changed files with 14 additions and 18 deletions

View File

@ -1,4 +1,4 @@
use std::{convert::TryFrom, fmt::Debug, io, sync::Arc}; use std::{convert::TryFrom, fmt::Debug, sync::Arc};
use futures::executor::block_on; use futures::executor::block_on;
use serde::Serialize; use serde::Serialize;
@ -388,7 +388,7 @@ impl Inspector {
} }
} }
fn main() -> io::Result<()> { fn main() {
let argparse = Argparse::new("state-inspector") let argparse = Argparse::new("state-inspector")
.global_setting(ArgParseSettings::DisableVersion) .global_setting(ArgParseSettings::DisableVersion)
.global_setting(ArgParseSettings::VersionlessSubcommands) .global_setting(ArgParseSettings::VersionlessSubcommands)
@ -430,6 +430,4 @@ fn main() -> io::Result<()> {
} else { } else {
block_on(inspector.run(matches)); block_on(inspector.run(matches));
} }
Ok(())
} }

View File

@ -495,20 +495,17 @@ impl BaseClient {
}, },
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]
AnySyncRoomEvent::Message(message) => { AnySyncRoomEvent::Message(AnySyncMessageEvent::RoomEncrypted(
if let AnySyncMessageEvent::RoomEncrypted(encrypted) = message { encrypted,
if let Some(olm) = self.olm_machine().await { )) => {
if let Ok(decrypted) = if let Some(olm) = self.olm_machine().await {
olm.decrypt_room_event(encrypted, room_id).await if let Ok(decrypted) =
{ olm.decrypt_room_event(encrypted, room_id).await
match decrypted.deserialize() { {
Ok(decrypted) => e = decrypted, match decrypted.deserialize() {
Err(e) => { Ok(decrypted) => e = decrypted,
warn!( Err(e) => {
"Error deserializing a decrypted event {:?} ", warn!("Error deserializing a decrypted event {:?} ", e)
e
)
}
} }
} }
} }

View File

@ -134,6 +134,7 @@ impl VerificationRequest {
self.inner.lock().unwrap().accept() self.inner.lock().unwrap().accept()
} }
#[allow(clippy::unnecessary_wraps)]
pub(crate) fn receive_ready( pub(crate) fn receive_ready(
&self, &self,
sender: &UserId, sender: &UserId,