fix: apply automatic clippy fixes across workspace
This commit is contained in:
1 parent
73ab5037d8
commit
5da422d23a
12 files changed
+99
-115
No files matched your search
+7
-10
@@ -14,31 +14,28 @@ pub fn extract_log_prefix(json_str: &str, is_response: bool) -> String {
|
||||
let id = ID_REGEX
|
||||
.captures(json_str)
|
||||
.and_then(|c| c.get(1))
|
||||
.map(|m| m.as_str())
|
||||
.unwrap_or("null");
|
||||
.map_or("null", |m| m.as_str());
|
||||
|
||||
if is_response {
|
||||
let is_error = ERROR_REGEX.is_match(json_str) || IS_ERROR_REGEX.is_match(json_str);
|
||||
return format!("Response id={} [Error: {}]", id, is_error);
|
||||
return format!("Response id={id} [Error: {is_error}]");
|
||||
}
|
||||
|
||||
let method = METHOD_REGEX
|
||||
.captures(json_str)
|
||||
.and_then(|c| c.get(1))
|
||||
.map(|m| m.as_str())
|
||||
.unwrap_or("");
|
||||
.map_or("", |m| m.as_str());
|
||||
|
||||
if method == "tools/call" {
|
||||
let tool = TOOL_REGEX
|
||||
.captures(json_str)
|
||||
.and_then(|c| c.get(1))
|
||||
.map(|m| m.as_str())
|
||||
.unwrap_or("unknown");
|
||||
format!("ToolCall[{}] id={}", tool, id)
|
||||
.map_or("unknown", |m| m.as_str());
|
||||
format!("ToolCall[{tool}] id={id}")
|
||||
} else if !method.is_empty() {
|
||||
format!("Request[{}] id={}", method, id)
|
||||
format!("Request[{method}] id={id}")
|
||||
} else if id != "null" {
|
||||
format!("Response id={}", id)
|
||||
format!("Response id={id}")
|
||||
} else {
|
||||
"Message".to_string()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user