diff --git a/linux-nvim/build.rs b/linux-nvim/build.rs index c266efa..4bd8caf 100644 --- a/linux-nvim/build.rs +++ b/linux-nvim/build.rs @@ -16,5 +16,5 @@ fn main() { .unwrap_or_else(|| "unknown".to_string()); let version = format!("{} ({})", git_date.trim(), git_hash.trim()); - println!("cargo:rustc-env=APP_VERSION={}", version); + println!("cargo:rustc-env=APP_VERSION={version}"); } diff --git a/nvim-core/src/lib.rs b/nvim-core/src/lib.rs index 00be919..ec1ab7f 100644 --- a/nvim-core/src/lib.rs +++ b/nvim-core/src/lib.rs @@ -55,7 +55,7 @@ pub async fn send_error(id: Value, code: i32, message: &str) { async fn get_socket_path() -> Result { let profile = std::env::var("USERPROFILE").unwrap_or_else(|_| "C:\\Users\\reazul.ashraf".into()); - let path = format!("{}\\.gemini\\active_nvim.txt", profile); + let path = format!("{profile}\\.gemini\\active_nvim.txt"); if let Ok(content) = tokio::fs::read_to_string(&path).await { let p = content.trim().to_string(); @@ -63,10 +63,9 @@ async fn get_socket_path() -> Result { if p.starts_with(r"\\.\pipe\") { return Ok(p); } else if p.starts_with("nvim.") { - return Ok(format!(r"\\.\pipe\{}", p)); - } else { - return Ok(p); + return Ok(format!(r"\\.\pipe\{p}")); } + return Ok(p); } } @@ -76,7 +75,7 @@ async fn get_socket_path() -> Result { let name = entry.file_name(); let name_str = name.to_string_lossy(); if name_str.starts_with("nvim.") { - return Ok(format!(r"\\.\pipe\{}", name_str)); + return Ok(format!(r"\\.\pipe\{name_str}")); } } } @@ -196,7 +195,7 @@ async fn get_nvim_connection() -> Result, String> { if let rmpv::Value::Array(ref arr) = val { if arr.len() >= 4 && arr[0] == rmpv::Value::Integer(1.into()) { let msgid = &arr[1]; - let msgid_str = format!("{:?}", msgid); + let msgid_str = format!("{msgid:?}"); if let Some(reply_sender) = pending_clone2.lock().unwrap().remove(&msgid_str) @@ -283,7 +282,7 @@ async fn call_nvim(req: rmpv::Value) -> Result { rmpv::Value::Nil }; - let msgid_str = format!("{:?}", msgid); + let msgid_str = format!("{msgid:?}"); let tx = get_nvim_connection().await?; let (reply_tx, reply_rx) = oneshot::channel(); @@ -373,7 +372,7 @@ async fn get_nvim_cursor() -> Result { if let RmpValue::Array(pos) = &arr[3] { if pos.len() == 2 { if let (RmpValue::Integer(row), RmpValue::Integer(col)) = (&pos[0], &pos[1]) { - return Ok(format!("Line: {}, Column: {}", row, col)); + return Ok(format!("Line: {row}, Column: {col}")); } } } @@ -419,19 +418,18 @@ async fn get_nvim_visual_selection() -> Result { } async fn set_nvim_diagnostics(line: i64, message: &str) -> Result<(), String> { - let escaped_message = message.replace("\\", "\\\\").replace("\"", "\\\""); + let escaped_message = message.replace('\\', "\\\\").replace('"', "\\\""); let lua_script = format!( r#" local ns = vim.api.nvim_create_namespace("gemini_diagnostics") local diagnostics = {{{{ - lnum = {} - 1, + lnum = {line} - 1, col = 0, severity = vim.diagnostic.severity.WARN, - message = "{}", + message = "{escaped_message}", }}}} vim.diagnostic.set(ns, 0, diagnostics, {{}}) - "#, - line, escaped_message + "# ); use rmpv::Value as RmpValue; @@ -487,7 +485,7 @@ fn rmpv_to_json(val: &rmpv::Value) -> serde_json::Value { let key_str = if let rmpv::Value::String(s) = k { s.as_str().unwrap_or("").to_string() } else { - format!("{:?}", k) + format!("{k:?}") }; obj.insert(key_str, rmpv_to_json(v)); } @@ -514,7 +512,7 @@ async fn execute_nvim_lua(code: &str) -> Result { if arr.len() > 3 { return Ok(serde_json::to_string_pretty(&rmpv_to_json(&arr[3])).unwrap_or_default()); } - return Ok("".to_string()); + return Ok(String::new()); } Err("Invalid response".to_string()) } @@ -549,12 +547,9 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { tracing::info!("{} MCP server started", app_name); let mut stdin = tokio::io::BufReader::new(tokio::io::stdin()); loop { - let raw_msg = match mcp_stdio::read_mcp_message(&mut stdin).await { - Some(m) => m, - None => { - tracing::info!("Stdin closed, exiting loop"); - break; - } + let raw_msg = if let Some(m) = mcp_stdio::read_mcp_message(&mut stdin).await { m } else { + tracing::info!("Stdin closed, exiting loop"); + break; }; let msg = match serde_json::from_str::(&raw_msg) { @@ -586,7 +581,7 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { .and_then(|p| p.get("name")) .and_then(|n| n.as_str()) .unwrap_or("unknown"); - format!("ToolCall[{}]", tool_name) + format!("ToolCall[{tool_name}]") } else { msg.method.clone() }; @@ -698,7 +693,7 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { ] })), error: None, - }).await + }).await; } "tools/call" => { let params = msg.params.unwrap_or(json!({})); @@ -710,12 +705,12 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { "nvim_goto_line" => { if let (Some(file), Some(line)) = ( args.get("file").and_then(|v| v.as_str()), - args.get("line").and_then(|v| v.as_i64()), + args.get("line").and_then(serde_json::Value::as_i64), ) { - let escaped_file = file.replace("\\", "\\\\"); - let cmd = format!("e {} | {} | normal! zz", escaped_file, line); + let escaped_file = file.replace('\\', "\\\\"); + let cmd = format!("e {escaped_file} | {line} | normal! zz"); match send_nvim_command(&cmd).await { - Ok(_) => { + Ok(()) => { send_text_result!(id.clone(), format!("Successfully jumped to {} line {}", file, line)); } Err(e) => send_error(id, -32603, &e).await, @@ -744,11 +739,11 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { }, "nvim_set_diagnostics" => { if let (Some(line), Some(message)) = ( - args.get("line").and_then(|v| v.as_i64()), + args.get("line").and_then(serde_json::Value::as_i64), args.get("message").and_then(|v| v.as_str()), ) { match set_nvim_diagnostics(line, message).await { - Ok(_) => { + Ok(()) => { send_text_result!(id.clone(), format!("Successfully set diagnostic on line {}", line)); } Err(e) => send_error(id, -32603, &e).await, @@ -758,7 +753,7 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { } } "nvim_list_buffers" => { - let lua_code = r#" + let lua_code = r" local bufs = vim.api.nvim_list_bufs() local result = {} for _, buf in ipairs(bufs) do @@ -768,7 +763,7 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { end end return vim.fn.json_encode(result) - "#; + "; match execute_nvim_lua(lua_code).await { Ok(result) => { send_text_result!(id.clone(), result); @@ -777,7 +772,7 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { } } "nvim_get_diagnostics" => { - let lua_code = r#" + let lua_code = r" local bufnr = vim.api.nvim_get_current_buf() local diagnostics = vim.diagnostic.get(bufnr) local result = {} @@ -791,7 +786,7 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { }) end return vim.fn.json_encode(result) - "#; + "; match execute_nvim_lua(lua_code).await { Ok(result) => { send_text_result!(id.clone(), result); @@ -801,24 +796,24 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { } "nvim_open_file" => { - let json_str = serde_json::to_string(args).unwrap().replace("\\", "\\\\").replace("'", "\\'"); + let json_str = serde_json::to_string(args).unwrap().replace('\\', "\\\\").replace('\'', "\\'"); let code = format!(" - local args = vim.json.decode('{}') + local args = vim.json.decode('{json_str}') vim.cmd('edit ' .. vim.fn.fnameescape(args.file)) if args.filetype and args.filetype ~= '' then vim.bo.filetype = args.filetype end return 'Opened file ' .. args.file - ", json_str); + "); match execute_nvim_lua(&code).await { Ok(res) => send_text_result!(id.clone(), res), Err(e) => send_error(id, -32603, &e).await, } } "nvim_open_buffer" => { - let json_str = serde_json::to_string(args).unwrap().replace("\\", "\\\\").replace("'", "\\'"); + let json_str = serde_json::to_string(args).unwrap().replace('\\', "\\\\").replace('\'', "\\'"); let code = format!(" - local args = vim.json.decode('{}') + local args = vim.json.decode('{json_str}') local buf = vim.api.nvim_create_buf(true, true) if args.name and args.name ~= '' then pcall(vim.api.nvim_buf_set_name, buf, args.name) @@ -832,30 +827,30 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { end vim.api.nvim_win_set_buf(0, buf) return 'Opened buffer ' .. tostring(buf) - ", json_str); + "); match execute_nvim_lua(&code).await { Ok(res) => send_text_result!(id.clone(), res), Err(e) => send_error(id, -32603, &e).await, } } "nvim_close_buffer" => { - let json_str = serde_json::to_string(args).unwrap().replace("\\", "\\\\").replace("'", "\\'"); + let json_str = serde_json::to_string(args).unwrap().replace('\\', "\\\\").replace('\'', "\\'"); let code = format!(" - local args = vim.json.decode('{}') + local args = vim.json.decode('{json_str}') local buf = args.buf_id or vim.api.nvim_get_current_buf() local force = args.force or false vim.api.nvim_buf_delete(buf, {{ force = force }}) return 'Closed buffer ' .. tostring(buf) - ", json_str); + "); match execute_nvim_lua(&code).await { Ok(res) => send_text_result!(id.clone(), res), Err(e) => send_error(id, -32603, &e).await, } } "nvim_split_window" => { - let json_str = serde_json::to_string(args).unwrap().replace("\\", "\\\\").replace("'", "\\'"); + let json_str = serde_json::to_string(args).unwrap().replace('\\', "\\\\").replace('\'', "\\'"); let code = format!(" - local args = vim.json.decode('{}') + local args = vim.json.decode('{json_str}') local cmd = args.direction == 'horizontal' and 'split' or 'vsplit' vim.cmd(cmd) if args.file and args.file ~= '' then @@ -864,16 +859,16 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { vim.api.nvim_win_set_buf(0, args.buf_id) end return 'Split window created' - ", json_str); + "); match execute_nvim_lua(&code).await { Ok(res) => send_text_result!(id.clone(), res), Err(e) => send_error(id, -32603, &e).await, } } "nvim_reload_buffer" => { - let json_str = serde_json::to_string(args).unwrap().replace("\\", "\\\\").replace("'", "\\'"); + let json_str = serde_json::to_string(args).unwrap().replace('\\', "\\\\").replace('\'', "\\'"); let code = format!(" - local args = vim.json.decode('{}') + local args = vim.json.decode('{json_str}') local buf = args.buf_id or vim.api.nvim_get_current_buf() vim.api.nvim_buf_call(buf, function() if args.force then @@ -883,7 +878,7 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { end end) return 'Reloaded buffer ' .. tostring(buf) - ", json_str); + "); match execute_nvim_lua(&code).await { Ok(res) => send_text_result!(id.clone(), res), Err(e) => send_error(id, -32603, &e).await, @@ -900,9 +895,9 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { } } "nvim_set_quickfix" => { - let json_str = serde_json::to_string(args).unwrap().replace("\\", "\\\\").replace("'", "\\'"); + let json_str = serde_json::to_string(args).unwrap().replace('\\', "\\\\").replace('\'', "\\'"); let code = format!(" - local args = vim.json.decode('{}') + local args = vim.json.decode('{json_str}') local items = args.items or {{}} local action = ' ' if args.action == 'append' then action = 'a' end @@ -911,16 +906,16 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { vim.fn.setqflist(items, action) vim.cmd('copen') return 'Populated quickfix with ' .. tostring(#items) .. ' items' - ", json_str); + "); match execute_nvim_lua(&code).await { Ok(res) => send_text_result!(id.clone(), res), Err(e) => send_error(id, -32603, &e).await, } } "nvim_highlight_lines" => { - let json_str = serde_json::to_string(args).unwrap().replace("\\", "\\\\").replace("'", "\\'"); + let json_str = serde_json::to_string(args).unwrap().replace('\\', "\\\\").replace('\'', "\\'"); let code = format!(" - local args = vim.json.decode('{}') + local args = vim.json.decode('{json_str}') local buf = args.buf_id or vim.api.nvim_get_current_buf() local group = args.group or 'IncSearch' local ns = vim.api.nvim_create_namespace('antigravity_highlight') @@ -942,16 +937,16 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { end, duration) end return 'Highlighted lines ' .. tostring(args.start_line) .. ' to ' .. tostring(args.end_line) - ", json_str); + "); match execute_nvim_lua(&code).await { Ok(res) => send_text_result!(id.clone(), res), Err(e) => send_error(id, -32603, &e).await, } } "nvim_get_messages" => { - let json_str = serde_json::to_string(args).unwrap().replace("\\", "\\\\").replace("'", "\\'"); + let json_str = serde_json::to_string(args).unwrap().replace('\\', "\\\\").replace('\'', "\\'"); let code = format!(" - local args = vim.json.decode('{}') + local args = vim.json.decode('{json_str}') local msg = vim.fn.execute('messages') local lines = vim.split(msg, '\\n') if args.tail and args.tail > 0 and #lines > args.tail then @@ -962,7 +957,7 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { return table.concat(tail_lines, '\\n') end return msg - ", json_str); + "); match execute_nvim_lua(&code).await { Ok(res) => send_text_result!(id.clone(), res), Err(e) => send_error(id, -32603, &e).await, @@ -1001,10 +996,10 @@ pub async fn run_mcp_loop(app_name: &str, app_version: &str) { } } _ => { - if !id.is_null() { - send_error(id, -32601, "Method not found").await; - } else { + if id.is_null() { // Ignore notifications silently + } else { + send_error(id, -32601, "Method not found").await; } } } @@ -1025,7 +1020,7 @@ fn init_logging(app_name: &str) -> tracing_appender::non_blocking::WorkerGuard { .join(".gemini/mcp_memory/logs"); std::fs::create_dir_all(&log_dir).unwrap_or_default(); - let file_appender = tracing_appender::rolling::daily(log_dir, format!("{}.log", app_name)); + let file_appender = tracing_appender::rolling::daily(log_dir, format!("{app_name}.log")); let (non_blocking, guard) = tracing_appender::non_blocking(file_appender); let _ = tracing_subscriber::fmt() diff --git a/server/build.rs b/server/build.rs index 8dad37f..214fcb0 100644 --- a/server/build.rs +++ b/server/build.rs @@ -12,10 +12,7 @@ fn main() { let is_dirty = Command::new("git") .args(["status", "--porcelain"]) - .output() - .ok() - .map(|out| !out.stdout.is_empty()) - .unwrap_or(false); + .output().is_ok_and(|out| !out.stdout.is_empty()); if is_dirty { git_hash.push_str("-dirty"); @@ -23,8 +20,8 @@ fn main() { let build_date = chrono::Local::now().format("%y.%m.%d.%H%M%S").to_string(); - let version = format!("{} ({})", build_date, git_hash); - println!("cargo:rustc-env=APP_VERSION={}", version); + let version = format!("{build_date} ({git_hash})"); + println!("cargo:rustc-env=APP_VERSION={version}"); if std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default() == "windows" { let mut res = winres::WindowsResource::new(); diff --git a/server/tests/parity_test.rs b/server/tests/parity_test.rs index 195afd8..2f0fa2e 100644 --- a/server/tests/parity_test.rs +++ b/server/tests/parity_test.rs @@ -11,9 +11,9 @@ fn test_eager_tools_parity() { let memory_source = std::fs::read_to_string(entry.path()).unwrap(); let parts: Vec<&str> = memory_source.split("crate::mcp::tool_def").collect(); for part in parts.iter().skip(1) { - if let Some(start) = part.find("\"") { + if let Some(start) = part.find('"') { let rest = &part[start + 1..]; - if let Some(end) = rest.find("\"") { + if let Some(end) = rest.find('"') { memory_tools.insert(rest[..end].to_string()); } } @@ -34,7 +34,7 @@ fn test_eager_tools_parity() { && let Some(start) = line.find("\"name\": \"") { let rest = &line[start + 9..]; - if let Some(end) = rest.find("\"") { + if let Some(end) = rest.find('"') { nvim_tools.insert(rest[..end].to_string()); } } @@ -57,8 +57,7 @@ fn test_eager_tools_parity() { let name = tool.as_str().unwrap(); assert!( memory_tools.contains(name), - "Windows config Memory tool '{}' not implemented in handlers.rs!", - name + "Windows config Memory tool '{name}' not implemented in handlers.rs!" ); } } @@ -68,8 +67,7 @@ fn test_eager_tools_parity() { let name = tool.as_str().unwrap(); assert!( nvim_tools.contains(name), - "Windows config Nvim tool '{}' not implemented in nvim-core!", - name + "Windows config Nvim tool '{name}' not implemented in nvim-core!" ); } } diff --git a/stub/build.rs b/stub/build.rs index c266efa..4bd8caf 100644 --- a/stub/build.rs +++ b/stub/build.rs @@ -16,5 +16,5 @@ fn main() { .unwrap_or_else(|| "unknown".to_string()); let version = format!("{} ({})", git_date.trim(), git_hash.trim()); - println!("cargo:rustc-env=APP_VERSION={}", version); + println!("cargo:rustc-env=APP_VERSION={version}"); } diff --git a/stub/src/bin/skeletal_client.rs b/stub/src/bin/skeletal_client.rs index ecbaa82..b72647d 100644 --- a/stub/src/bin/skeletal_client.rs +++ b/stub/src/bin/skeletal_client.rs @@ -17,7 +17,7 @@ async fn main() -> Result<(), Box> { .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> { 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> { } 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> { _ = 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)); diff --git a/stub/src/logger.rs b/stub/src/logger.rs index 06f96e6..6b98323 100644 --- a/stub/src/logger.rs +++ b/stub/src/logger.rs @@ -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() } diff --git a/stub/src/main.rs b/stub/src/main.rs index a5d7daa..d5565e1 100644 --- a/stub/src/main.rs +++ b/stub/src/main.rs @@ -17,7 +17,7 @@ fn init_logging(app_name: &str) -> Option Result<(), Box> { 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() { diff --git a/stub/tests/e2e.rs b/stub/tests/e2e.rs index c391c13..0e9d4af 100644 --- a/stub/tests/e2e.rs +++ b/stub/tests/e2e.rs @@ -14,7 +14,7 @@ impl Drop for ChildGuard { fn send_message(stdin: &mut std::process::ChildStdin, msg: Value) { let s = serde_json::to_string(&msg).unwrap(); - let payload = format!("{}\n", s); + let payload = format!("{s}\n"); stdin.write_all(payload.as_bytes()).unwrap(); stdin.flush().unwrap(); } @@ -56,9 +56,9 @@ async fn test_full_system_e2e_performance() { let nvim_exe = debug_dir.join(format!("{}{}", nvim_name, std::env::consts::EXE_SUFFIX)); let stub_exe = debug_dir.join(format!("mcp-memory-stub{}", std::env::consts::EXE_SUFFIX)); - assert!(server_exe.exists(), "Server not found at {:?}", server_exe); - assert!(nvim_exe.exists(), "Nvim not found at {:?}", nvim_exe); - assert!(stub_exe.exists(), "Stub not found at {:?}", stub_exe); + assert!(server_exe.exists(), "Server not found at {server_exe:?}"); + assert!(nvim_exe.exists(), "Nvim not found at {nvim_exe:?}"); + assert!(stub_exe.exists(), "Stub not found at {stub_exe:?}"); // 1. Start Server let _server = ChildGuard( @@ -83,7 +83,7 @@ async fn test_full_system_e2e_performance() { let mut started = false; for _ in 0..30 { if let Ok(resp) = client - .get(format!("http://127.0.0.1:{}/health", test_port)) + .get(format!("http://127.0.0.1:{test_port}/health")) .send() .await && resp.status().is_success() @@ -99,7 +99,7 @@ async fn test_full_system_e2e_performance() { let mut stub = ChildGuard( Command::new(&stub_exe) .arg("--target") - .arg(format!("http://127.0.0.1:{}", test_port)) + .arg(format!("http://127.0.0.1:{test_port}")) .env("MCP_MEMORY_STORE_DIR", temp_dir.to_str().unwrap()) .env("MCP_AUTH_TOKEN", test_auth_token) .env("RUST_LOG", "debug") @@ -144,7 +144,7 @@ async fn test_full_system_e2e_performance() { send_message(&mut stub_stdin, tools_req); } else { let s = serde_json::to_string(&tools_req).unwrap(); - stub_stdin.write_all(format!("{}\n", s).as_bytes()).unwrap(); + stub_stdin.write_all(format!("{s}\n").as_bytes()).unwrap(); stub_stdin.flush().unwrap(); } @@ -156,7 +156,7 @@ async fn test_full_system_e2e_performance() { assert_eq!(resp["id"], i); } let stub_duration = start_time.elapsed(); - println!("Stub 100 requests: {:?}", stub_duration); + println!("Stub 100 requests: {stub_duration:?}"); // Send 100 concurrent-like sequential rapid requests to Win-Nvim println!("Starting 100 requests to nvim..."); @@ -173,7 +173,7 @@ async fn test_full_system_e2e_performance() { send_message(&mut nvim_stdin, tools_req); } else { let s = serde_json::to_string(&tools_req).unwrap(); - nvim_stdin.write_all(format!("{}\n", s).as_bytes()).unwrap(); + nvim_stdin.write_all(format!("{s}\n").as_bytes()).unwrap(); nvim_stdin.flush().unwrap(); } @@ -187,8 +187,8 @@ async fn test_full_system_e2e_performance() { } let nvim_duration = start_time_nvim.elapsed(); - println!("Stub 100 requests: {:?}", stub_duration); - println!("Win-Nvim 100 requests: {:?}", nvim_duration); + println!("Stub 100 requests: {stub_duration:?}"); + println!("Win-Nvim 100 requests: {nvim_duration:?}"); let _ = std::fs::remove_dir_all(temp_dir); } diff --git a/stub/tests/negative_scenarios.rs b/stub/tests/negative_scenarios.rs index 634bc42..8352fc3 100644 --- a/stub/tests/negative_scenarios.rs +++ b/stub/tests/negative_scenarios.rs @@ -31,8 +31,7 @@ async fn test_stub_connection_refused() { assert!( res.is_ok(), - "Stub hung on connection refused! Took {:?}", - elapsed + "Stub hung on connection refused! Took {elapsed:?}" ); } @@ -65,7 +64,7 @@ async fn test_stub_handles_eof_cleanly() { let res = tokio::time::timeout(Duration::from_secs(5), child.wait()).await; let elapsed = start.elapsed(); - assert!(res.is_ok(), "Stub hung after EOF! Took {:?}", elapsed); + assert!(res.is_ok(), "Stub hung after EOF! Took {elapsed:?}"); } #[tokio::test] @@ -102,7 +101,6 @@ async fn test_stub_sse_fallback_failure() { assert!( res.is_ok(), - "Stub hung on fallback failure! Took {:?}", - elapsed + "Stub hung on fallback failure! Took {elapsed:?}" ); } diff --git a/win-nvim/build.rs b/win-nvim/build.rs index c266efa..4bd8caf 100644 --- a/win-nvim/build.rs +++ b/win-nvim/build.rs @@ -16,5 +16,5 @@ fn main() { .unwrap_or_else(|| "unknown".to_string()); let version = format!("{} ({})", git_date.trim(), git_hash.trim()); - println!("cargo:rustc-env=APP_VERSION={}", version); + println!("cargo:rustc-env=APP_VERSION={version}"); } diff --git a/win-nvim/tests/integration_test.rs b/win-nvim/tests/integration_test.rs index a80c1f6..80818fa 100644 --- a/win-nvim/tests/integration_test.rs +++ b/win-nvim/tests/integration_test.rs @@ -4,7 +4,7 @@ use std::process::{Command, Stdio}; fn send_message(stdin: &mut std::process::ChildStdin, msg: Value) { let s = serde_json::to_string(&msg).unwrap(); - stdin.write_all(format!("{}\n", s).as_bytes()).unwrap(); + stdin.write_all(format!("{s}\n").as_bytes()).unwrap(); stdin.flush().unwrap(); }