From 291189fb77528a6c8cd8ff1cb49f1f796f0f78a7 Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 2 Jul 2026 16:36:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(sanitizer):=20=E6=8A=98=E5=8F=A0=E5=B5=8C?= =?UTF-8?q?=E5=A5=97=20if=20=E4=BF=AE=E5=A4=8D=20clippy::collapsible=5Fif?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 865871f 引入的 checkbox type 白名单逻辑用了嵌套 if,触发 rust 1.96 的 clippy::collapsible_if,导致 make clippy 直接失败。按 clippy 建议 合并为单个 if 链,行为不变。 --- src/api/sanitizer.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/api/sanitizer.rs b/src/api/sanitizer.rs index 88945df..d896985 100644 --- a/src/api/sanitizer.rs +++ b/src/api/sanitizer.rs @@ -296,10 +296,11 @@ fn sanitize(input: &str, config: &SanitizerConfig) -> String { } // input 的 type 必须是 checkbox,其余取值(image/text/...)一概删除; // 缺失 type 的 input 由下面的兜底逻辑整标签移除。 - if tag == "input" && name_lower == "type" { - if attr.value().trim().to_lowercase() != "checkbox" { - return Some(name); - } + if tag == "input" + && name_lower == "type" + && attr.value().trim().to_lowercase() != "checkbox" + { + return Some(name); } None } else {