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:
@@ -82,7 +82,7 @@ pub fn substitute_variables(
|
||||
};
|
||||
|
||||
let regex = Regex::new(pattern)
|
||||
.map_err(|e| ComfyUIError::new(format!("Invalid regex pattern: {}", e)))?;
|
||||
.map_err(|e| ComfyUIError::new(format!("Invalid regex pattern: {e}")))?;
|
||||
|
||||
let mut result = template.to_string();
|
||||
let mut offset = 0i32;
|
||||
@@ -96,7 +96,7 @@ pub fn substitute_variables(
|
||||
Some(value) => value_to_string(value)?,
|
||||
None => {
|
||||
return Err(ComfyUIError::template_validation(
|
||||
format!("Parameter '{}' not found", var_name)
|
||||
format!("Parameter '{var_name}' not found")
|
||||
));
|
||||
}
|
||||
};
|
||||
@@ -139,7 +139,7 @@ pub fn extract_variables(template: &str, syntax: VariableSyntax) -> Result<Vec<S
|
||||
};
|
||||
|
||||
let regex = Regex::new(pattern)
|
||||
.map_err(|e| ComfyUIError::new(format!("Invalid regex pattern: {}", e)))?;
|
||||
.map_err(|e| ComfyUIError::new(format!("Invalid regex pattern: {e}")))?;
|
||||
|
||||
let mut variables = Vec::new();
|
||||
for captures in regex.captures_iter(template) {
|
||||
|
||||
Reference in New Issue
Block a user