From 55bef35d1f65a06effcc19aa1b51cc7eb2936932 Mon Sep 17 00:00:00 2001 From: xfy Date: Tue, 16 Jun 2026 12:40:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=B8=85=E7=90=86=20clippy=20?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=EF=BC=88unwrap=5For=20=E4=B8=8E=E5=AE=8F=20d?= =?UTF-8?q?eprecated=20=E6=94=BE=E8=A1=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/settings.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/api/settings.rs b/src/api/settings.rs index cdd423d..631f077 100644 --- a/src/api/settings.rs +++ b/src/api/settings.rs @@ -3,6 +3,9 @@ //! 所有接口需要 admin 权限。配置持久化到 settings 键值表。 //! Dioxus server function,注册在 `/api` 路径下。 +// 与 posts 模块一致:Dioxus `#[server]` 宏触发 deprecated/unit 提示,按项目惯例放行。 +#![allow(clippy::unused_unit, deprecated)] + use dioxus::prelude::*; use crate::models::settings::TrashSettings; @@ -32,7 +35,7 @@ pub async fn get_trash_settings() -> Result { .await .map_err(AppError::query)? .and_then(|r| r.get::<_, String>("value").parse().ok()) - .unwrap_or_else(|| crate::models::settings::DEFAULT_AUTO_PURGE_ENABLED); + .unwrap_or(crate::models::settings::DEFAULT_AUTO_PURGE_ENABLED); let days: i32 = client .query_opt( @@ -42,7 +45,7 @@ pub async fn get_trash_settings() -> Result { .await .map_err(AppError::query)? .and_then(|r| r.get::<_, String>("value").parse().ok()) - .unwrap_or_else(|| crate::models::settings::DEFAULT_RETENTION_DAYS); + .unwrap_or(crate::models::settings::DEFAULT_RETENTION_DAYS); Ok(TrashSettings { auto_purge_enabled: enabled,