From c13cb4957e9a760ea1b69192ff5501abb9f173c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 13 Jan 2023 11:56:00 +0100 Subject: [PATCH] chore(crypto): Don't use a JsOption needlessly. --- crates/matrix-sdk-crypto/src/machine.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/crates/matrix-sdk-crypto/src/machine.rs b/crates/matrix-sdk-crypto/src/machine.rs index b026c1803..be59f9a2c 100644 --- a/crates/matrix-sdk-crypto/src/machine.rs +++ b/crates/matrix-sdk-crypto/src/machine.rs @@ -39,8 +39,8 @@ use ruma::{ MessageLikeEventContent, }, serde::Raw, - DeviceId, DeviceKeyAlgorithm, JsOption, OwnedDeviceId, OwnedDeviceKeyId, OwnedTransactionId, - OwnedUserId, RoomId, TransactionId, UInt, UserId, + DeviceId, DeviceKeyAlgorithm, OwnedDeviceId, OwnedDeviceKeyId, OwnedTransactionId, OwnedUserId, + RoomId, TransactionId, UInt, UserId, }; use serde_json::{value::to_raw_value, Value}; use tracing::{debug, error, field::display, info, instrument, trace, warn}; @@ -862,7 +862,7 @@ impl OlmMachine { #[derive(Deserialize)] struct ContentStub<'a> { #[serde(borrow, rename = "org.matrix.msgid")] - message_id: JsOption<&'a str>, + message_id: Option<&'a str>, } #[derive(Deserialize)] @@ -871,10 +871,8 @@ impl OlmMachine { content: ContentStub<'a>, } - let message_id = event - .deserialize_as::>() - .ok() - .and_then(|t| t.content.message_id.into_option()); + let message_id = + event.deserialize_as::>().ok().and_then(|t| t.content.message_id); tracing::Span::current().record("message_id", message_id); }