Fix use-self

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-06-09 10:23:06 +00:00
parent c3c91e9d80
commit eae41fc411
18 changed files with 47 additions and 48 deletions

View file

@ -11,7 +11,7 @@ pub struct Cork {
impl Cork {
pub fn new(db: &Arc<dyn KeyValueDatabaseEngine>, flush: bool, sync: bool) -> Self {
db.cork().unwrap();
Cork {
Self {
db: db.clone(),
flush,
sync,

View file

@ -157,7 +157,7 @@ pub struct KeyValueDatabase {
impl KeyValueDatabase {
/// Load an existing database or create a new one.
#[allow(clippy::too_many_lines)]
pub async fn load_or_create(server: &Arc<Server>) -> Result<KeyValueDatabase> {
pub async fn load_or_create(server: &Arc<Server>) -> Result<Self> {
let config = &server.config;
check_db_setup(config)?;
let builder = build(config)?;

View file

@ -84,7 +84,7 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
db.latest_sequence_number(),
load_time.elapsed()
);
Ok(Arc::new(Engine {
Ok(Self::new(Engine {
config: config.clone(),
row_cache,
col_cache,
@ -110,7 +110,7 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
Ok(Arc::new(RocksDbEngineTree {
name,
db: Arc::clone(self),
db: Self::clone(self),
watchers: Watchers::default(),
}))
}

View file

@ -113,7 +113,7 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
let writer = Mutex::new(Engine::prepare_conn(&path, cache_size_per_thread)?);
let arc = Arc::new(Engine {
let arc = Self::new(Engine {
writer,
read_conn_tls: ThreadLocal::new(),
read_iterator_conn_tls: ThreadLocal::new(),
@ -131,7 +131,7 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
)?;
Ok(Arc::new(SqliteTable {
engine: Arc::clone(self),
engine: Self::clone(self),
name: name.to_owned(),
watchers: Watchers::default(),
}))