fix: clippy manual_flatten in skills.rs

This commit is contained in:
晴天
2026-04-07 03:34:56 +08:00
parent c968d179b1
commit 1b0ee6a18d

View File

@@ -463,13 +463,14 @@ fn custom_skill_roots() -> Vec<(std::path::PathBuf, &'static str)> {
let cli = std::path::PathBuf::from(&cli_path);
let cli = std::fs::canonicalize(&cli).unwrap_or(cli);
// CLI 可能在 bin/ 子目录或包根目录
for ancestor in [cli.parent(), cli.parent().and_then(|p| p.parent())] {
if let Some(pkg_root) = ancestor {
let bundled = pkg_root.join("skills");
if bundled.is_dir() && !roots.iter().any(|(dir, _)| dir == &bundled) {
roots.push((bundled, "OpenClaw 内置"));
break;
}
for pkg_root in [cli.parent(), cli.parent().and_then(|p| p.parent())]
.into_iter()
.flatten()
{
let bundled = pkg_root.join("skills");
if bundled.is_dir() && !roots.iter().any(|(dir, _)| dir == &bundled) {
roots.push((bundled, "OpenClaw 内置"));
break;
}
}
}