fix clippy

This commit is contained in:
otsmr 2026-06-08 22:59:50 +02:00
parent 37551cacce
commit 23553b9cb0
4 changed files with 8 additions and 6 deletions

View file

@ -13,6 +13,7 @@ use zip::{CompressionMethod, ZipArchive, ZipWriter};
pub(crate) struct BackupArchive {} pub(crate) struct BackupArchive {}
impl BackupArchive { impl BackupArchive {
#[allow(clippy::type_complexity)]
fn get_backup_files( fn get_backup_files(
ctx: &Context, ctx: &Context,
keys: &KeyManager, keys: &KeyManager,

View file

@ -31,6 +31,7 @@ macro_rules! callback_generator {
// 3. Generate the Automated Init Function // 3. Generate the Automated Init Function
paste::paste! { paste::paste! {
#[allow(clippy::too_many_arguments)]
pub fn init_flutter_callbacks( pub fn init_flutter_callbacks(
callback_id: u32, callback_id: u32,
$( $(

View file

@ -6,7 +6,7 @@ macro_rules! generate_insert {
pub async fn $fn_name( pub async fn $fn_name(
pool: &sqlx::SqlitePool, pool: &sqlx::SqlitePool,
$($field: $ty),+ $($field: $ty),+
) -> crate::error::Result<i64> { ) -> $crate::error::Result<i64> {
let sql = format!( let sql = format!(
"INSERT INTO {} ({}) VALUES ({}) RETURNING id", "INSERT INTO {} ({}) VALUES ({}) RETURNING id",
$table, $table,
@ -27,7 +27,7 @@ macro_rules! generate_insert {
#[macro_export] #[macro_export]
macro_rules! generate_select { macro_rules! generate_select {
($table:literal, $fn_name:ident) => { ($table:literal, $fn_name:ident) => {
pub async fn $fn_name(pool: &sqlx::SqlitePool) -> crate::error::Result<Vec<Self>> { pub async fn $fn_name(pool: &sqlx::SqlitePool) -> $crate::error::Result<Vec<Self>> {
let sql = format!("SELECT * FROM {}", $table); let sql = format!("SELECT * FROM {}", $table);
let results = sqlx::query_as::<_, Self>(sqlx::AssertSqlSafe(sql)) let results = sqlx::query_as::<_, Self>(sqlx::AssertSqlSafe(sql))
.fetch_all(pool) .fetch_all(pool)
@ -36,7 +36,7 @@ macro_rules! generate_select {
} }
}; };
($table:literal, $fn_name:ident, $($field:ident : $ty:ty),+) => { ($table:literal, $fn_name:ident, $($field:ident : $ty:ty),+) => {
pub async fn $fn_name(pool: &sqlx::SqlitePool, $($field: $ty),+) -> crate::error::Result<Vec<Self>> { pub async fn $fn_name(pool: &sqlx::SqlitePool, $($field: $ty),+) -> $crate::error::Result<Vec<Self>> {
let mut sql = format!("SELECT * FROM {} WHERE ", $table); let mut sql = format!("SELECT * FROM {} WHERE ", $table);
let mut filters = Vec::new(); let mut filters = Vec::new();
$( $(
@ -63,7 +63,7 @@ macro_rules! generate_table_tests {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::database::Database; use $crate::database::Database;
use tempfile::tempdir; use tempfile::tempdir;
#[tokio::test] #[tokio::test]
@ -91,7 +91,7 @@ macro_rules! generate_test_select {
use tempfile::tempdir; use tempfile::tempdir;
let dir = tempdir().unwrap(); let dir = tempdir().unwrap();
let db_path = dir.path().join("test.sqlite").display().to_string(); let db_path = dir.path().join("test.sqlite").display().to_string();
let db = crate::database::Database::new(&db_path, None, false).await.unwrap(); let db = $crate::database::Database::new(&db_path, None, false).await.unwrap();
db.run_migrations().await.unwrap(); db.run_migrations().await.unwrap();
$struct::$insert_fn(&db.pool, $($arg),+).await.unwrap(); $struct::$insert_fn(&db.pool, $($arg),+).await.unwrap();

View file

@ -66,7 +66,7 @@ impl MainKey {
// self.encrypt_with_info(b"media_main_key", media_key) // self.encrypt_with_info(b"media_main_key", media_key)
// } // }
/// Decrypts a wrapped media key using the derived Media Main Key. // Decrypts a wrapped media key using the derived Media Main Key.
// pub fn decrypt_media_key(&self, wrapped_media_key: &[u8]) -> Result<[u8; 32]> { // pub fn decrypt_media_key(&self, wrapped_media_key: &[u8]) -> Result<[u8; 32]> {
// let decrypted = self.decrypt_with_info(b"media_main_key", wrapped_media_key)?; // let decrypted = self.decrypt_with_info(b"media_main_key", wrapped_media_key)?;