fix: apply automatic clippy fixes across workspace

This commit is contained in:
Riz Ashraf committed 2026-09-21 11:41:55 +01:00
1 parent 73ab5037d8
commit 5da422d23a
12 files changed
+99 -115

No files matched your search

+4 -5
View File
@@ -17,7 +17,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.danger_accept_invalid_certs(true)
.build()?;
let sse_url = format!("{}/sse", target);
let sse_url = format!("{target}/sse");
tracing::info!("Connecting to SSE: {}", sse_url);
@@ -59,9 +59,8 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing::info!("Received POST endpoint: {}", data_content);
post_endpoint = Some(data_content);
break;
} else {
tracing::info!("Received early SSE data: {}", text);
}
tracing::info!("Received early SSE data: {}", text);
}
if post_endpoint.is_some() {
break;
@@ -69,7 +68,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
let post_endpoint = post_endpoint.ok_or("Did not receive endpoint from SSE stream")?;
let post_url = format!("{}{}", target, post_endpoint);
let post_url = format!("{target}{post_endpoint}");
let payload = r#"{"jsonrpc":"2.0","id":999,"method":"server/discover","params":{}}"#;
@@ -98,7 +97,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
_ = timeout.tick() => {
tracing::warn!("Timed out waiting for SSE response.");
}
_ = async {
() = async {
while let Some(chunk) = stream.next().await {
if let Ok(bytes) = chunk {
tracing::info!("Received SSE Chunk: {}", String::from_utf8_lossy(&bytes));
+7 -10
View File
@@ -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()
}
+6 -6
View File
@@ -17,7 +17,7 @@ fn init_logging(app_name: &str) -> Option<tracing_appender::non_blocking::Worker
base_dir.push(".gemini/mcp_memory/logs");
std::fs::create_dir_all(&base_dir).unwrap_or_default();
let file_appender = tracing_appender::rolling::daily(base_dir, format!("{}.log", app_name));
let file_appender = tracing_appender::rolling::daily(base_dir, format!("{app_name}.log"));
let (non_blocking, guard) = tracing_appender::non_blocking(file_appender);
let _ = tracing_subscriber::fmt()
@@ -45,16 +45,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let _ = shutdown_tx.send(()).await;
});
let target_url = if cli.target != "http://localhost:3000" {
cli.target
} else {
let target_url = if cli.target == "http://localhost:3000" {
let port = std::env::var("MCP_PORT").unwrap_or_else(|_| "3000".to_string());
format!("http://127.0.0.1:{}", port)
format!("http://127.0.0.1:{port}")
} else {
cli.target
};
let ws_url = target_url
.replace("http://", "ws://")
.replace("https://", "wss://");
let ws_url = format!("{}/ws?client=proxy", ws_url);
let ws_url = format!("{ws_url}/ws?client=proxy");
loop {
if shutdown_rx.try_recv().is_ok() {