From ffc520410992ad6d6862791968deb0dfd61f5c60 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Sat, 11 Jul 2020 20:57:01 +0200 Subject: [PATCH] Fix two pattern matching related warnings --- matrix_sdk/examples/autojoin.rs | 17 +++++++---------- matrix_sdk_base/src/client.rs | 4 ++-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/matrix_sdk/examples/autojoin.rs b/matrix_sdk/examples/autojoin.rs index 943ab4f0..ed73a48e 100644 --- a/matrix_sdk/examples/autojoin.rs +++ b/matrix_sdk/examples/autojoin.rs @@ -30,16 +30,13 @@ impl EventEmitter for AutoJoinBot { return; } - match room { - SyncRoom::Invited(room) => { - let room = room.read().await; - println!("Autojoining room {}", room.display_name()); - self.client - .join_room_by_id(&room.room_id) - .await - .expect("Can't join room"); - } - _ => (), + if let SyncRoom::Invited(room) = room { + let room = room.read().await; + println!("Autojoining room {}", room.display_name()); + self.client + .join_room_by_id(&room.room_id) + .await + .expect("Can't join room"); } } } diff --git a/matrix_sdk_base/src/client.rs b/matrix_sdk_base/src/client.rs index c37ca77b..94f345f0 100644 --- a/matrix_sdk_base/src/client.rs +++ b/matrix_sdk_base/src/client.rs @@ -727,8 +727,8 @@ impl BaseClient { let mut olm = self.olm.lock().await; if let Some(o) = &mut *olm { - if let Some(decrypted) = - o.decrypt_room_event(&encrypted_event, room_id).await.ok() + if let Ok(decrypted) = + o.decrypt_room_event(&encrypted_event, room_id).await { if let Ok(d) = decrypted.deserialize() { e = d