fix: 修复ComfyUI SDK的cargo check和clippy警告

- 修复ComfyUIError中WebSocket变体过大的问题,使用Box包装
- 添加自定义From实现处理Box包装的WebSocket错误
- 修复所有格式化字符串警告,使用内联格式化
- 移除无用的类型转换(reqwest::Error::from)
- 修复代码质量问题:
  - 简化if语句嵌套
  - 使用?操作符替代显式错误处理
  - 优化map迭代方式
  - 使用is_some_and替代map_or

修复内容:
- 44个clippy警告全部解决
- 所有测试通过
- cargo check --lib 无错误无警告
This commit is contained in:
2025-08-08 16:12:25 +08:00
parent e874d281e0
commit e69ce2b817
9 changed files with 63 additions and 71 deletions

View File

@@ -62,7 +62,7 @@ impl WorkflowInstance {
// Check if parameter exists in template
if !self.template.has_parameter(&name) {
return Err(ComfyUIError::parameter_validation(
format!("Parameter '{}' does not exist in template", name)
format!("Parameter '{name}' does not exist in template")
));
}
@@ -93,7 +93,7 @@ impl WorkflowInstance {
for name in parameters.keys() {
if !self.template.has_parameter(name) {
return Err(ComfyUIError::parameter_validation(
format!("Parameter '{}' does not exist in template", name)
format!("Parameter '{name}' does not exist in template")
));
}
}