style: fix clippy warnings and prettier formatting

- Inline format args in openclaw_config.rs, webdav_sync.rs, archive.rs
- Replace map_or(false, ..) with is_some_and(..) in live.rs
- Fix prettier line-break formatting in claudeProviderPresets.ts
This commit is contained in:
YoVinchen
2026-02-25 22:15:49 +08:00
parent 6427ab2128
commit a86f22422b
5 changed files with 8 additions and 13 deletions
+1 -1
View File
@@ -222,7 +222,7 @@ pub fn read_openclaw_config() -> Result<Value, AppError> {
// 尝试 JSON5 解析(支持注释和尾随逗号)
json5::from_str(&content)
.map_err(|e| AppError::Config(format!("Failed to parse OpenClaw config as JSON5: {}", e)))
.map_err(|e| AppError::Config(format!("Failed to parse OpenClaw config as JSON5: {e}")))
}
/// 写入 OpenClaw 配置文件(原子写入)
+1 -1
View File
@@ -357,7 +357,7 @@ fn json_merge_patch(target: &mut Value, patch: &Value) {
let entry = target_obj.entry(key.clone()).or_insert(json!({}));
json_merge_patch(entry, value);
// Clean up empty container objects
if entry.as_object().map_or(false, |o| o.is_empty()) {
if entry.as_object().is_some_and(|o| o.is_empty()) {
target_obj.remove(key);
}
} else {
+2 -5
View File
@@ -533,11 +533,8 @@ fn validate_artifact_size_limit(artifact_name: &str, size: u64) -> Result<(), Ap
let max_mb = MAX_SYNC_ARTIFACT_BYTES / 1024 / 1024;
return Err(localized(
"webdav.sync.artifact_too_large",
format!("artifact {artifact_name} 超过下载上限({} MB", max_mb),
format!(
"Artifact {artifact_name} exceeds download limit ({} MB)",
max_mb
),
format!("artifact {artifact_name} 超过下载上限({max_mb} MB"),
format!("Artifact {artifact_name} exceeds download limit ({max_mb} MB)"),
));
}
Ok(())
@@ -350,8 +350,8 @@ fn copy_entry_with_total_limit<R: Read, W: Write>(
let max_mb = max_total_bytes / 1024 / 1024;
return Err(localized(
"webdav.sync.skills_zip_too_large",
format!("skills.zip 解压后体积超过上限({} MB", max_mb),
format!("skills.zip extracted size exceeds limit ({} MB)", max_mb),
format!("skills.zip 解压后体积超过上限({max_mb} MB"),
format!("skills.zip extracted size exceeds limit ({max_mb} MB)"),
));
}
+2 -4
View File
@@ -544,8 +544,7 @@ export const providerPresets: ProviderPreset[] = [
ANTHROPIC_MODEL: "global.anthropic.claude-opus-4-6-v1",
ANTHROPIC_DEFAULT_HAIKU_MODEL:
"global.anthropic.claude-haiku-4-5-20251001-v1:0",
ANTHROPIC_DEFAULT_SONNET_MODEL:
"global.anthropic.claude-sonnet-4-6",
ANTHROPIC_DEFAULT_SONNET_MODEL: "global.anthropic.claude-sonnet-4-6",
ANTHROPIC_DEFAULT_OPUS_MODEL: "global.anthropic.claude-opus-4-6-v1",
CLAUDE_CODE_USE_BEDROCK: "1",
},
@@ -583,8 +582,7 @@ export const providerPresets: ProviderPreset[] = [
ANTHROPIC_MODEL: "global.anthropic.claude-opus-4-6-v1",
ANTHROPIC_DEFAULT_HAIKU_MODEL:
"global.anthropic.claude-haiku-4-5-20251001-v1:0",
ANTHROPIC_DEFAULT_SONNET_MODEL:
"global.anthropic.claude-sonnet-4-6",
ANTHROPIC_DEFAULT_SONNET_MODEL: "global.anthropic.claude-sonnet-4-6",
ANTHROPIC_DEFAULT_OPUS_MODEL: "global.anthropic.claude-opus-4-6-v1",
CLAUDE_CODE_USE_BEDROCK: "1",
},