From 79eb07f71753e813d032a8e091a293417cd77a36 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Thu, 1 Apr 2021 19:35:09 +0200 Subject: [PATCH] Allow Result aliases to be used with two type parameters --- matrix_sdk_base/src/error.rs | 2 +- matrix_sdk_base/src/store/mod.rs | 2 +- matrix_sdk_base/src/store/sled_store/mod.rs | 9 +++------ matrix_sdk_crypto/src/store/mod.rs | 2 +- matrix_sdk_crypto/src/store/sled.rs | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/matrix_sdk_base/src/error.rs b/matrix_sdk_base/src/error.rs index ef28dad4..a7946f57 100644 --- a/matrix_sdk_base/src/error.rs +++ b/matrix_sdk_base/src/error.rs @@ -23,7 +23,7 @@ use thiserror::Error; use matrix_sdk_crypto::{CryptoStoreError, MegolmError, OlmError}; /// Result type of the rust-sdk. -pub type Result = std::result::Result; +pub type Result = std::result::Result; /// Internal representation of errors. #[derive(Error, Debug)] diff --git a/matrix_sdk_base/src/store/mod.rs b/matrix_sdk_base/src/store/mod.rs index 82d9b4d8..3db1e379 100644 --- a/matrix_sdk_base/src/store/mod.rs +++ b/matrix_sdk_base/src/store/mod.rs @@ -76,7 +76,7 @@ pub enum StoreError { } /// A `StateStore` specific result type. -pub type Result = std::result::Result; +pub type Result = std::result::Result; /// An abstract state store trait that can be used to implement different stores /// for the SDK. diff --git a/matrix_sdk_base/src/store/sled_store/mod.rs b/matrix_sdk_base/src/store/sled_store/mod.rs index ddec715c..ddded62b 100644 --- a/matrix_sdk_base/src/store/sled_store/mod.rs +++ b/matrix_sdk_base/src/store/sled_store/mod.rs @@ -249,10 +249,7 @@ impl SledStore { SledStore::open_helper(db, Some(path), None) } - fn serialize_event( - &self, - event: &impl Serialize, - ) -> std::result::Result, SerializationError> { + fn serialize_event(&self, event: &impl Serialize) -> Result, SerializationError> { if let Some(key) = &*self.store_key { let encrypted = key.encrypt(event)?; Ok(serde_json::to_vec(&encrypted)?) @@ -264,7 +261,7 @@ impl SledStore { fn deserialize_event Deserialize<'b>>( &self, event: &[u8], - ) -> std::result::Result { + ) -> Result { if let Some(key) = &*self.store_key { let encrypted: EncryptedEvent = serde_json::from_slice(&event)?; Ok(key.decrypt(encrypted)?) @@ -297,7 +294,7 @@ impl SledStore { pub async fn save_changes(&self, changes: &StateChanges) -> Result<()> { let now = SystemTime::now(); - let ret: std::result::Result<(), TransactionError> = ( + let ret: Result<(), TransactionError> = ( &self.session, &self.account_data, &self.members, diff --git a/matrix_sdk_crypto/src/store/mod.rs b/matrix_sdk_crypto/src/store/mod.rs index e8e21f3e..a837dfd0 100644 --- a/matrix_sdk_crypto/src/store/mod.rs +++ b/matrix_sdk_crypto/src/store/mod.rs @@ -82,7 +82,7 @@ use crate::{ }; /// A `CryptoStore` specific result type. -pub type Result = std::result::Result; +pub type Result = std::result::Result; /// A wrapper for our CryptoStore trait object. /// diff --git a/matrix_sdk_crypto/src/store/sled.rs b/matrix_sdk_crypto/src/store/sled.rs index b7f1282a..d44ce5e5 100644 --- a/matrix_sdk_crypto/src/store/sled.rs +++ b/matrix_sdk_crypto/src/store/sled.rs @@ -333,7 +333,7 @@ impl SledStore { let identity_changes = changes.identities; let olm_hashes = changes.message_hashes; - let ret: std::result::Result<(), TransactionError> = ( + let ret: Result<(), TransactionError> = ( &self.account, &self.private_identity, &self.devices,