diff --git a/crates/matrix-sdk-indexeddb/src/state_store.rs b/crates/matrix-sdk-indexeddb/src/state_store.rs index 73d022526..26513c971 100644 --- a/crates/matrix-sdk-indexeddb/src/state_store.rs +++ b/crates/matrix-sdk-indexeddb/src/state_store.rs @@ -473,20 +473,14 @@ impl IndexeddbStateStore { IndexeddbStateStore::builder().name(name).build().await.map_err(StoreError::backend) } - fn serialize_event( - &self, - event: &impl Serialize, - ) -> std::result::Result { + fn serialize_event(&self, event: &impl Serialize) -> Result { Ok(match &self.store_cipher { Some(cipher) => JsValue::from_serde(&cipher.encrypt_value_typed(event)?)?, None => JsValue::from_serde(event)?, }) } - fn deserialize_event( - &self, - event: JsValue, - ) -> std::result::Result { + fn deserialize_event(&self, event: JsValue) -> Result { match &self.store_cipher { Some(cipher) => Ok(cipher.decrypt_value_typed(event.into_serde()?)?), None => Ok(event.into_serde()?), @@ -503,11 +497,7 @@ impl IndexeddbStateStore { } } - fn encode_to_range( - &self, - table_name: &str, - key: T, - ) -> Result + fn encode_to_range(&self, table_name: &str, key: T) -> Result where T: SafeEncode, { @@ -1043,7 +1033,7 @@ impl IndexeddbStateStore { } } - tx.await.into_result().map_err::(|e| e.into()) + tx.await.into_result().map_err(|e| e.into()) } pub async fn get_presence_event(&self, user_id: &UserId) -> Result>> { @@ -1368,7 +1358,7 @@ impl IndexeddbStateStore { tx.object_store(KEYS::CUSTOM)?.put_key_val(&jskey, &self.serialize_event(&value)?)?; - tx.await.into_result().map_err::(|e| e.into())?; + tx.await.into_result().map_err(IndexeddbStateStoreError::from)?; Ok(prev) } @@ -1441,7 +1431,7 @@ impl IndexeddbStateStore { store.delete(&key)?; } } - tx.await.into_result().map_err::(|e| e.into()) + tx.await.into_result().map_err(|e| e.into()) } #[cfg(feature = "experimental-timeline")]