fix(sanitizer): 折叠嵌套 if 修复 clippy::collapsible_if

865871f 引入的 checkbox type 白名单逻辑用了嵌套 if,触发 rust 1.96
的 clippy::collapsible_if,导致 make clippy 直接失败。按 clippy 建议
合并为单个 if 链,行为不变。
This commit is contained in:
xfy 2026-07-02 16:36:05 +08:00
parent 59359b18ce
commit 291189fb77

View File

@ -296,10 +296,11 @@ fn sanitize(input: &str, config: &SanitizerConfig) -> String {
} }
// input 的 type 必须是 checkbox其余取值image/text/...)一概删除; // input 的 type 必须是 checkbox其余取值image/text/...)一概删除;
// 缺失 type 的 input 由下面的兜底逻辑整标签移除。 // 缺失 type 的 input 由下面的兜底逻辑整标签移除。
if tag == "input" && name_lower == "type" { if tag == "input"
if attr.value().trim().to_lowercase() != "checkbox" { && name_lower == "type"
return Some(name); && attr.value().trim().to_lowercase() != "checkbox"
} {
return Some(name);
} }
None None
} else { } else {