diff --git a/crates/matrix-sdk-sqlite/src/crypto_store.rs b/crates/matrix-sdk-sqlite/src/crypto_store.rs index 4f28b4812..58e2e4d28 100644 --- a/crates/matrix-sdk-sqlite/src/crypto_store.rs +++ b/crates/matrix-sdk-sqlite/src/crypto_store.rs @@ -16,7 +16,7 @@ use std::{ borrow::Cow, collections::HashMap, fmt, - path::{Path, PathBuf}, + path::Path, sync::{Arc, RwLock}, }; @@ -55,7 +55,6 @@ use crate::{ #[derive(Clone)] pub struct SqliteCryptoStore { store_cipher: Option>, - path: Option, pool: SqlitePool, // DB values cached in memory @@ -66,11 +65,7 @@ pub struct SqliteCryptoStore { #[cfg(not(tarpaulin_include))] impl fmt::Debug for SqliteCryptoStore { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if let Some(path) = &self.path { - f.debug_struct("SqliteCryptoStore").field("path", &path).finish() - } else { - f.debug_struct("SqliteCryptoStore").field("path", &"memory store").finish() - } + f.debug_struct("SqliteCryptoStore").finish_non_exhaustive() } } @@ -105,7 +100,6 @@ impl SqliteCryptoStore { Ok(SqliteCryptoStore { store_cipher, - path: None, pool, static_account: Arc::new(RwLock::new(None)), save_changes_lock: Default::default(), diff --git a/crates/matrix-sdk-sqlite/src/event_cache_store.rs b/crates/matrix-sdk-sqlite/src/event_cache_store.rs index e59c1d902..98e3f2f42 100644 --- a/crates/matrix-sdk-sqlite/src/event_cache_store.rs +++ b/crates/matrix-sdk-sqlite/src/event_cache_store.rs @@ -1,9 +1,4 @@ -use std::{ - borrow::Cow, - fmt, - path::{Path, PathBuf}, - sync::Arc, -}; +use std::{borrow::Cow, fmt, path::Path, sync::Arc}; use async_trait::async_trait; use deadpool_sqlite::{Object as SqliteConn, Pool as SqlitePool, Runtime}; @@ -39,18 +34,13 @@ const DATABASE_VERSION: u8 = 1; #[derive(Clone)] pub struct SqliteEventCacheStore { store_cipher: Option>, - path: Option, pool: SqlitePool, } #[cfg(not(tarpaulin_include))] impl fmt::Debug for SqliteEventCacheStore { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if let Some(path) = &self.path { - f.debug_struct("SqliteEventCacheStore").field("path", &path).finish() - } else { - f.debug_struct("SqliteEventCacheStore").field("path", &"memory store").finish() - } + f.debug_struct("SqliteEventCacheStore").finish_non_exhaustive() } } @@ -84,7 +74,7 @@ impl SqliteEventCacheStore { Some(p) => Some(Arc::new(get_or_create_store_cipher(p, &conn).await?)), None => None, }; - let this = Self { store_cipher, path: None, pool }; + let this = Self { store_cipher, pool }; this.run_migrations(&conn, version, None).await?; Ok(this) diff --git a/crates/matrix-sdk-sqlite/src/state_store.rs b/crates/matrix-sdk-sqlite/src/state_store.rs index 9f41fdf1d..242d452a7 100644 --- a/crates/matrix-sdk-sqlite/src/state_store.rs +++ b/crates/matrix-sdk-sqlite/src/state_store.rs @@ -2,7 +2,7 @@ use std::{ borrow::Cow, collections::{BTreeMap, BTreeSet}, fmt, iter, - path::{Path, PathBuf}, + path::Path, sync::Arc, }; @@ -72,18 +72,13 @@ const DATABASE_VERSION: u8 = 7; #[derive(Clone)] pub struct SqliteStateStore { store_cipher: Option>, - path: Option, pool: SqlitePool, } #[cfg(not(tarpaulin_include))] impl fmt::Debug for SqliteStateStore { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if let Some(path) = &self.path { - f.debug_struct("SqliteStateStore").field("path", &path).finish() - } else { - f.debug_struct("SqliteStateStore").field("path", &"memory store").finish() - } + f.debug_struct("SqliteStateStore").finish_non_exhaustive() } } @@ -117,7 +112,7 @@ impl SqliteStateStore { Some(p) => Some(Arc::new(get_or_create_store_cipher(p, &conn).await?)), None => None, }; - let this = Self { store_cipher, path: None, pool }; + let this = Self { store_cipher, pool }; this.run_migrations(&conn, version, None).await?; Ok(this) @@ -2023,7 +2018,7 @@ mod migration_tests { init(&conn).await?; let store_cipher = Some(Arc::new(get_or_create_store_cipher(SECRET, &conn).await.unwrap())); - let this = SqliteStateStore { store_cipher, path: None, pool }; + let this = SqliteStateStore { store_cipher, pool }; this.run_migrations(&conn, 1, Some(version)).await?; Ok(this)