diff --git a/crates/matrix-sdk-crypto/src/olm/account.rs b/crates/matrix-sdk-crypto/src/olm/account.rs index 8eb52770d..f332f018d 100644 --- a/crates/matrix-sdk-crypto/src/olm/account.rs +++ b/crates/matrix-sdk-crypto/src/olm/account.rs @@ -746,17 +746,16 @@ impl ReadOnlyAccount { pub(crate) fn unsigned_device_keys(&self) -> DeviceKeys { let identity_keys = self.identity_keys(); - - let mut keys = BTreeMap::new(); - - keys.insert( - DeviceKeyId::from_parts(DeviceKeyAlgorithm::Curve25519, &self.device_id), - identity_keys.curve25519().to_owned(), - ); - keys.insert( - DeviceKeyId::from_parts(DeviceKeyAlgorithm::Ed25519, &self.device_id), - identity_keys.ed25519().to_owned(), - ); + let keys = BTreeMap::from([ + ( + DeviceKeyId::from_parts(DeviceKeyAlgorithm::Curve25519, &self.device_id), + identity_keys.curve25519().to_owned(), + ), + ( + DeviceKeyId::from_parts(DeviceKeyAlgorithm::Ed25519, &self.device_id), + identity_keys.ed25519().to_owned(), + ), + ]); DeviceKeys::new( (*self.user_id).clone(), diff --git a/crates/matrix-sdk-crypto/src/olm/signing/pk_signing.rs b/crates/matrix-sdk-crypto/src/olm/signing/pk_signing.rs index 964da3554..750340497 100644 --- a/crates/matrix-sdk-crypto/src/olm/signing/pk_signing.rs +++ b/crates/matrix-sdk-crypto/src/olm/signing/pk_signing.rs @@ -397,13 +397,11 @@ impl Signing { } pub fn cross_signing_key(&self, user_id: UserId, usage: KeyUsage) -> CrossSigningKey { - let mut keys = BTreeMap::new(); - - keys.insert( + let keys = BTreeMap::from([( DeviceKeyId::from_parts(DeviceKeyAlgorithm::Ed25519, self.public_key().as_str().into()) .to_string(), self.public_key().to_string(), - ); + )]); CrossSigningKey::new(user_id, vec![usage], keys, BTreeMap::new()) }