fix more clippy lints (part 1)

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
strawberry 2024-01-14 22:39:08 -05:00 committed by June
parent 44440f745f
commit 59c7f93656
19 changed files with 77 additions and 80 deletions

View file

@ -7,12 +7,12 @@ use std::{future::Future, pin::Pin, sync::Arc};
pub mod sqlite;
#[cfg(feature = "rocksdb")]
pub mod rocksdb;
pub(crate) mod rocksdb;
#[cfg(any(feature = "sqlite", feature = "rocksdb"))]
pub mod watchers;
pub(crate) mod watchers;
pub trait KeyValueDatabaseEngine: Send + Sync {
pub(crate) trait KeyValueDatabaseEngine: Send + Sync {
fn open(config: &Config) -> Result<Self>
where
Self: Sized;
@ -27,7 +27,7 @@ pub trait KeyValueDatabaseEngine: Send + Sync {
fn clear_caches(&self) {}
}
pub trait KvTree: Send + Sync {
pub(crate) trait KvTree: Send + Sync {
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>>;
fn insert(&self, key: &[u8], value: &[u8]) -> Result<()>;

View file

@ -8,14 +8,14 @@ use std::{
use rocksdb::LogLevel::{Debug, Error, Fatal, Info, Warn};
pub struct Engine {
pub(crate) struct Engine {
rocks: rocksdb::DBWithThreadMode<rocksdb::MultiThreaded>,
cache: rocksdb::Cache,
old_cfs: Vec<String>,
config: Config,
}
pub struct RocksDbEngineTree<'a> {
struct RocksDbEngineTree<'a> {
db: Arc<Engine>,
name: &'a str,
watchers: Watchers,

View file

@ -11,8 +11,8 @@ use ruma::{
use crate::{database::KeyValueDatabase, service, services, utils, Error, Result};
pub const COUNTER: &[u8] = b"c";
pub const LAST_CHECK_FOR_UPDATES_COUNT: &[u8] = b"u";
const COUNTER: &[u8] = b"c";
const LAST_CHECK_FOR_UPDATES_COUNT: &[u8] = b"u";
#[async_trait]
impl service::globals::Data for KeyValueDatabase {

View file

@ -1,5 +1,5 @@
pub mod abstraction;
pub mod key_value;
pub(crate) mod abstraction;
pub(crate) mod key_value;
use crate::{
service::rooms::{edus::presence::presence_handler, timeline::PduCount},
@ -1094,7 +1094,7 @@ impl KeyValueDatabase {
use tokio::time::Instant;
let timer_interval =
Duration::from_secs(services().globals.config.cleanup_second_interval as u64);
Duration::from_secs(u64::from(services().globals.config.cleanup_second_interval));
fn perform_cleanup() {
let start = Instant::now();