chore: fix formatting and clippy lints

This commit is contained in:
Riz Ashraf committed 2026-10-08 23:01:38 +01:00
1 parent 8952bd5399
commit 9d9e959744
35 files changed
+1091 -582

No files matched your search

+24 -8
View File
@@ -48,28 +48,45 @@ mod tests {
#[test]
fn test_extract_log_prefix_response() {
let json_str = r#"{"jsonrpc":"2.0","id":123,"result":{}}"#;
assert_eq!(extract_log_prefix(json_str, true), "Response id=123 [Error: false]");
assert_eq!(
extract_log_prefix(json_str, true),
"Response id=123 [Error: false]"
);
let err_json = r#"{"jsonrpc":"2.0","id":456,"error":{"code":-32600,"message":"Invalid Request"}}"#;
assert_eq!(extract_log_prefix(err_json, true), "Response id=456 [Error: true]");
let err_json =
r#"{"jsonrpc":"2.0","id":456,"error":{"code":-32600,"message":"Invalid Request"}}"#;
assert_eq!(
extract_log_prefix(err_json, true),
"Response id=456 [Error: true]"
);
let is_err_json = r#"{"jsonrpc":"2.0","id":789,"result":{"isError":true}}"#;
assert_eq!(extract_log_prefix(is_err_json, true), "Response id=789 [Error: true]");
assert_eq!(
extract_log_prefix(is_err_json, true),
"Response id=789 [Error: true]"
);
}
#[test]
fn test_extract_log_prefix_tool_call() {
let json_str = r#"{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search"}}"#;
let json_str =
r#"{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search"}}"#;
assert_eq!(extract_log_prefix(json_str, false), "ToolCall[search] id=1");
let unknown_tool = r#"{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{}}"#;
assert_eq!(extract_log_prefix(unknown_tool, false), "ToolCall[unknown] id=2");
assert_eq!(
extract_log_prefix(unknown_tool, false),
"ToolCall[unknown] id=2"
);
}
#[test]
fn test_extract_log_prefix_request() {
let json_str = r#"{"jsonrpc":"2.0","id":10,"method":"initialize"}"#;
assert_eq!(extract_log_prefix(json_str, false), "Request[initialize] id=10");
assert_eq!(
extract_log_prefix(json_str, false),
"Request[initialize] id=10"
);
}
#[test]
@@ -84,4 +101,3 @@ mod tests {
assert_eq!(extract_log_prefix(json_str, false), "Message");
}
}
+2 -2
View File
@@ -170,11 +170,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
}
}
if retry_count >= 20 {
return Err("Failed to connect to the MCP memory server after multiple attempts. Is it running?".into());
}
Ok(())
})
}