From e4289405f514c78b0d68491bfaabcf6e4692f40d Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 9 Mar 2022 17:56:26 +0100 Subject: [PATCH] Stop importing Result as StdResult The SDK's Result aliases can optionally take the error parameter, so there is no need to disambiguate this way. --- crates/matrix-sdk-base/src/client.rs | 7 +++---- crates/matrix-sdk/src/client.rs | 3 +-- crates/matrix-sdk/src/encryption/mod.rs | 10 +++++----- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/crates/matrix-sdk-base/src/client.rs b/crates/matrix-sdk-base/src/client.rs index e34e3deb1..b3b182948 100644 --- a/crates/matrix-sdk-base/src/client.rs +++ b/crates/matrix-sdk-base/src/client.rs @@ -20,7 +20,6 @@ use std::{ collections::{BTreeMap, BTreeSet}, convert::TryFrom, fmt, - result::Result as StdResult, sync::Arc, }; @@ -121,7 +120,7 @@ pub struct BaseClientConfig { #[cfg(not(tarpaulin_include))] impl std::fmt::Debug for BaseClientConfig { - fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> StdResult<(), std::fmt::Error> { + fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { fmt.debug_struct("BaseClientConfig").finish() } } @@ -1120,7 +1119,7 @@ impl BaseClient { &self, user_id: &UserId, device_id: &DeviceId, - ) -> StdResult, CryptoStoreError> { + ) -> Result, CryptoStoreError> { if let Some(olm) = self.olm_machine().await { olm.get_device(user_id, device_id).await } else { @@ -1175,7 +1174,7 @@ impl BaseClient { pub async fn get_user_devices( &self, user_id: &UserId, - ) -> StdResult { + ) -> Result { if let Some(olm) = self.olm_machine().await { Ok(olm.get_user_devices(user_id).await?) } else { diff --git a/crates/matrix-sdk/src/client.rs b/crates/matrix-sdk/src/client.rs index 16ab9011d..34bc746de 100644 --- a/crates/matrix-sdk/src/client.rs +++ b/crates/matrix-sdk/src/client.rs @@ -19,7 +19,6 @@ use std::{ future::Future, io::Read, pin::Pin, - result::Result as StdResult, sync::{Arc, RwLock as StdRwLock}, }; @@ -151,7 +150,7 @@ pub(crate) struct ClientInner { #[cfg(not(tarpaulin_include))] impl Debug for Client { - fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> StdResult<(), fmt::Error> { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { write!(fmt, "Client") } } diff --git a/crates/matrix-sdk/src/encryption/mod.rs b/crates/matrix-sdk/src/encryption/mod.rs index c591366e0..c22cd9b2a 100644 --- a/crates/matrix-sdk/src/encryption/mod.rs +++ b/crates/matrix-sdk/src/encryption/mod.rs @@ -252,7 +252,7 @@ use std::{ collections::{BTreeMap, HashSet}, io::{Read, Write}, path::PathBuf, - result::Result as StdResult, iter, + iter, }; use futures_util::stream::{self, StreamExt}; @@ -389,7 +389,7 @@ impl Client { &self, user_id: &UserId, device_id: &DeviceId, - ) -> StdResult, CryptoStoreError> { + ) -> Result, CryptoStoreError> { let device = self.base_client().get_device(user_id, device_id).await?; Ok(device.map(|d| Device { inner: d, client: self.clone() })) @@ -426,7 +426,7 @@ impl Client { pub async fn get_user_devices( &self, user_id: &UserId, - ) -> StdResult { + ) -> Result { let devices = self.base_client().get_user_devices(user_id).await?; Ok(UserDevices { inner: devices, client: self.clone() }) @@ -467,7 +467,7 @@ impl Client { pub async fn get_user_identity( &self, user_id: &UserId, - ) -> StdResult, CryptoStoreError> { + ) -> Result, CryptoStoreError> { use crate::encryption::identities::UserIdentity; if let Some(olm) = self.olm_machine().await { @@ -671,7 +671,7 @@ impl Client { &self, path: PathBuf, passphrase: &str, - ) -> StdResult { + ) -> Result { let olm = self.olm_machine().await.ok_or(RoomKeyImportError::StoreClosed)?; let passphrase = zeroize::Zeroizing::new(passphrase.to_owned());