Use #[expect], lint reasons

This commit is contained in:
Lambda 2024-09-05 19:01:22 +00:00
parent e14b7f28f2
commit b09c44a0ca
49 changed files with 157 additions and 161 deletions

View file

@ -95,13 +95,17 @@ pub(crate) struct KeyValueDatabase {
pub(super) roomuserid_lastprivatereadupdate: Arc<dyn KvTree>,
// PresenceId = RoomId + Count + UserId
// This exists in the database already but is currently unused
#[allow(dead_code)]
#[expect(
dead_code,
reason = "This exists in the database already but is currently unused"
)]
pub(super) presenceid_presence: Arc<dyn KvTree>,
// LastPresenceUpdate = Count
// This exists in the database already but is currently unused
#[allow(dead_code)]
#[expect(
dead_code,
reason = "This exists in the database already but is currently unused"
)]
pub(super) userid_lastpresenceupdate: Arc<dyn KvTree>,
// Trees "owned" by `self::key_value::rooms`
@ -317,7 +321,7 @@ impl KeyValueDatabase {
not(any(feature = "rocksdb", feature = "sqlite")),
allow(unreachable_code)
)]
#[allow(clippy::too_many_lines)]
#[expect(clippy::too_many_lines)]
pub(crate) fn load_or_create(config: &Config) -> Result<KeyValueDatabase> {
Self::check_db_setup(config)?;
@ -478,7 +482,7 @@ impl KeyValueDatabase {
.try_into()
.expect("pdu cache capacity fits into usize"),
)),
#[allow(
#[expect(
clippy::as_conversions,
clippy::cast_sign_loss,
clippy::cast_possible_truncation
@ -486,7 +490,7 @@ impl KeyValueDatabase {
auth_chain_cache: Mutex::new(LruCache::new(
(100_000.0 * config.cache_capacity_modifier) as usize,
)),
#[allow(
#[expect(
clippy::as_conversions,
clippy::cast_sign_loss,
clippy::cast_possible_truncation
@ -494,7 +498,7 @@ impl KeyValueDatabase {
shorteventid_cache: Mutex::new(LruCache::new(
(100_000.0 * config.cache_capacity_modifier) as usize,
)),
#[allow(
#[expect(
clippy::as_conversions,
clippy::cast_sign_loss,
clippy::cast_possible_truncation
@ -502,7 +506,7 @@ impl KeyValueDatabase {
eventidshort_cache: Mutex::new(LruCache::new(
(100_000.0 * config.cache_capacity_modifier) as usize,
)),
#[allow(
#[expect(
clippy::as_conversions,
clippy::cast_sign_loss,
clippy::cast_possible_truncation
@ -510,7 +514,7 @@ impl KeyValueDatabase {
shortstatekey_cache: Mutex::new(LruCache::new(
(100_000.0 * config.cache_capacity_modifier) as usize,
)),
#[allow(
#[expect(
clippy::as_conversions,
clippy::cast_sign_loss,
clippy::cast_possible_truncation
@ -531,7 +535,7 @@ impl KeyValueDatabase {
///
/// If it is not possible to migrate the database to the current version,
/// returns an error.
#[allow(clippy::too_many_lines)]
#[expect(clippy::too_many_lines)]
pub(crate) async fn apply_migrations(&self) -> Result<()> {
// If the database has any data, perform data migrations before starting
let latest_database_version = 13;