From 1cc4bc5aebb9a1096e6fc87a25e81a22f8d266f8 Mon Sep 17 00:00:00 2001 From: xfy Date: Mon, 15 Jun 2026 14:15:11 +0800 Subject: [PATCH] =?UTF-8?q?style(list):=20=E7=AE=80=E5=8C=96=E5=A4=9A?= =?UTF-8?q?=E8=A1=8C=E8=A1=A8=E8=BE=BE=E5=BC=8F=E4=B8=BA=E5=8D=95=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/posts/list.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/api/posts/list.rs b/src/api/posts/list.rs index a7e740d..34f2082 100644 --- a/src/api/posts/list.rs +++ b/src/api/posts/list.rs @@ -31,10 +31,7 @@ const MAX_PAGE: i32 = 10_000; /// /// 注意:返回值必须同时用于缓存键与 SQL 查询,避免同一逻辑页落入不同缓存条目。 fn clamp_pagination(page: i32, per_page: i32) -> (i32, i32) { - ( - page.clamp(1, MAX_PAGE), - per_page.clamp(1, MAX_PER_PAGE), - ) + (page.clamp(1, MAX_PAGE), per_page.clamp(1, MAX_PER_PAGE)) } /// 获取已发布文章分页列表。 @@ -269,9 +266,6 @@ mod tests { #[test] fn clamp_pagination_max_per_page_boundary() { assert_eq!(clamp_pagination(1, MAX_PER_PAGE), (1, MAX_PER_PAGE)); - assert_eq!( - clamp_pagination(1, MAX_PER_PAGE - 1), - (1, MAX_PER_PAGE - 1) - ); + assert_eq!(clamp_pagination(1, MAX_PER_PAGE - 1), (1, MAX_PER_PAGE - 1)); } }