diff --git a/crates/matrix-sdk-base/src/rooms/normal.rs b/crates/matrix-sdk-base/src/rooms/normal.rs index f54cbdfc6..512cce85c 100644 --- a/crates/matrix-sdk-base/src/rooms/normal.rs +++ b/crates/matrix-sdk-base/src/rooms/normal.rs @@ -177,7 +177,13 @@ impl Room { /// Get the avatar url of this room. pub fn avatar_url(&self) -> Option { - self.inner.read().unwrap().base_info.avatar.as_ref()?.as_original()?.content.url.clone() + self.inner + .read() + .unwrap() + .base_info + .avatar + .as_ref() + .and_then(|e| e.as_original().and_then(|e| e.content.url.clone())) } /// Get the canonical alias of this room. @@ -194,7 +200,13 @@ impl Room { /// It can also be redacted in current room versions, leaving only the /// `creator` field. pub fn create_content(&self) -> Option { - Some(self.inner.read().unwrap().base_info.create.as_ref()?.as_original()?.content.clone()) + self.inner + .read() + .unwrap() + .base_info + .create + .as_ref() + .and_then(|e| e.as_original().map(|e| e.content.clone())) } /// Is this room considered a direct message. diff --git a/crates/matrix-sdk-crypto/src/gossiping/mod.rs b/crates/matrix-sdk-crypto/src/gossiping/mod.rs index 8a5427e57..d998081a1 100644 --- a/crates/matrix-sdk-crypto/src/gossiping/mod.rs +++ b/crates/matrix-sdk-crypto/src/gossiping/mod.rs @@ -43,7 +43,7 @@ use crate::{ }; /// An error describing why a key share request won't be honored. -#[derive(Debug, Clone, Error, PartialEq)] +#[derive(Debug, Clone, Error, PartialEq, Eq)] pub enum KeyForwardDecision { /// The key request is from a device that we don't own, we're only sharing /// sessions that we know the requesting device already was supposed to get. diff --git a/crates/matrix-sdk-crypto/src/identities/device.rs b/crates/matrix-sdk-crypto/src/identities/device.rs index 96fa116f7..d843bc1be 100644 --- a/crates/matrix-sdk-crypto/src/identities/device.rs +++ b/crates/matrix-sdk-crypto/src/identities/device.rs @@ -348,7 +348,7 @@ impl UserDevices { } } -#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] /// The local trust state of a device. pub enum LocalTrust { /// The device has been verified and is trusted. diff --git a/crates/matrix-sdk-crypto/src/lib.rs b/crates/matrix-sdk-crypto/src/lib.rs index 3709691ea..3d57bcc6c 100644 --- a/crates/matrix-sdk-crypto/src/lib.rs +++ b/crates/matrix-sdk-crypto/src/lib.rs @@ -45,7 +45,7 @@ use std::collections::{BTreeMap, BTreeSet}; use ruma::OwnedRoomId; /// Return type for the room key importing. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct RoomKeyImportResult { /// The number of room keys that were imported. pub imported_count: usize, diff --git a/crates/matrix-sdk-crypto/src/types/one_time_keys.rs b/crates/matrix-sdk-crypto/src/types/one_time_keys.rs index e28379504..f3c609535 100644 --- a/crates/matrix-sdk-crypto/src/types/one_time_keys.rs +++ b/crates/matrix-sdk-crypto/src/types/one_time_keys.rs @@ -29,7 +29,7 @@ use vodozemac::{Curve25519PublicKey, Ed25519Signature}; pub type SignedKeySignatures = BTreeMap>; /// A key for the SignedCurve25519 algorithm -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct SignedKey { // /// The Curve25519 key that can be used to establish Olm sessions. #[serde(deserialize_with = "deserialize_curve_key", serialize_with = "serialize_curve_key")] @@ -151,7 +151,7 @@ impl SignedKey { } /// A one-time public key for "pre-key" messages. -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(untagged)] pub enum OneTimeKey { /// A signed Curve25519 one-time key. diff --git a/crates/matrix-sdk-crypto/src/verification/mod.rs b/crates/matrix-sdk-crypto/src/verification/mod.rs index eb24d0178..496ca7188 100644 --- a/crates/matrix-sdk-crypto/src/verification/mod.rs +++ b/crates/matrix-sdk-crypto/src/verification/mod.rs @@ -376,7 +376,7 @@ impl Cancelled { } } -#[derive(Clone, Debug, Hash, PartialEq, PartialOrd)] +#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd)] pub enum FlowId { ToDevice(OwnedTransactionId), InRoom(OwnedRoomId, OwnedEventId), diff --git a/crates/matrix-sdk-store-encryption/src/lib.rs b/crates/matrix-sdk-store-encryption/src/lib.rs index 2b2735647..f582a9470 100644 --- a/crates/matrix-sdk-store-encryption/src/lib.rs +++ b/crates/matrix-sdk-store-encryption/src/lib.rs @@ -500,7 +500,7 @@ impl MacKey { /// Encrypted value, ready for storage, as created by the /// [`StoreCipher::encrypt_value_data()`] -#[derive(Debug, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] pub struct EncryptedValue { version: u8, ciphertext: Vec, @@ -557,7 +557,7 @@ impl Keys { } /// Version specific info for the key derivation method that is used. -#[derive(Debug, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] enum KdfInfo { /// The PBKDF2 to Chacha key derivation variant. Pbkdf2ToChaCha20Poly1305 { @@ -572,7 +572,7 @@ enum KdfInfo { /// Version specific info for encryption method that is used to encrypt our /// store cipher. -#[derive(Debug, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] enum CipherTextInfo { /// A store cipher encrypted using the ChaCha20Poly1305 AEAD. ChaCha20Poly1305 { @@ -585,7 +585,7 @@ enum CipherTextInfo { /// An encrypted version of our store cipher, this can be safely stored in a /// database. -#[derive(Debug, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)] struct EncryptedStoreCipher { /// Info about the key derivation method that was used to expand the /// passphrase into an encryption key.