mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-06-13 10:42:12 +00:00
fix clippy
This commit is contained in:
parent
37551cacce
commit
23553b9cb0
4 changed files with 8 additions and 6 deletions
|
|
@ -13,6 +13,7 @@ use zip::{CompressionMethod, ZipArchive, ZipWriter};
|
|||
pub(crate) struct BackupArchive {}
|
||||
|
||||
impl BackupArchive {
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn get_backup_files(
|
||||
ctx: &Context,
|
||||
keys: &KeyManager,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ macro_rules! callback_generator {
|
|||
|
||||
// 3. Generate the Automated Init Function
|
||||
paste::paste! {
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn init_flutter_callbacks(
|
||||
callback_id: u32,
|
||||
$(
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ macro_rules! generate_insert {
|
|||
pub async fn $fn_name(
|
||||
pool: &sqlx::SqlitePool,
|
||||
$($field: $ty),+
|
||||
) -> crate::error::Result<i64> {
|
||||
) -> $crate::error::Result<i64> {
|
||||
let sql = format!(
|
||||
"INSERT INTO {} ({}) VALUES ({}) RETURNING id",
|
||||
$table,
|
||||
|
|
@ -27,7 +27,7 @@ macro_rules! generate_insert {
|
|||
#[macro_export]
|
||||
macro_rules! generate_select {
|
||||
($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 results = sqlx::query_as::<_, Self>(sqlx::AssertSqlSafe(sql))
|
||||
.fetch_all(pool)
|
||||
|
|
@ -36,7 +36,7 @@ macro_rules! generate_select {
|
|||
}
|
||||
};
|
||||
($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 filters = Vec::new();
|
||||
$(
|
||||
|
|
@ -63,7 +63,7 @@ macro_rules! generate_table_tests {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::database::Database;
|
||||
use $crate::database::Database;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[tokio::test]
|
||||
|
|
@ -91,7 +91,7 @@ macro_rules! generate_test_select {
|
|||
use tempfile::tempdir;
|
||||
let dir = tempdir().unwrap();
|
||||
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();
|
||||
|
||||
$struct::$insert_fn(&db.pool, $($arg),+).await.unwrap();
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ impl MainKey {
|
|||
// 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]> {
|
||||
// let decrypted = self.decrypt_with_info(b"media_main_key", wrapped_media_key)?;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue