From 0f156770f652b514b15e0e83d5f2e387caceaf5a Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Sat, 23 Aug 2025 13:06:04 -0300 Subject: [PATCH] fix: resolve borrow and move errors and remove unused imports Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- src/modes/server/api/mcp.rs | 1 - src/modes/server/mcp/server.rs | 2 +- src/modes/server/mcp/tools.rs | 15 +++++++-------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/modes/server/api/mcp.rs b/src/modes/server/api/mcp.rs index d418e36..d528dac 100644 --- a/src/modes/server/api/mcp.rs +++ b/src/modes/server/api/mcp.rs @@ -7,7 +7,6 @@ use futures::stream::{self, Stream}; use log::{debug, info}; use std::convert::Infallible; use std::time::Duration; -use tokio_stream::StreamExt as _; use crate::modes::server::common::AppState; use crate::modes::server::mcp::KeepMcpServer; diff --git a/src/modes/server/mcp/server.rs b/src/modes/server/mcp/server.rs index 191f812..98cd03c 100644 --- a/src/modes/server/mcp/server.rs +++ b/src/modes/server/mcp/server.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use log::{debug, warn}; +use log::debug; use serde_json::Value; use crate::modes::server::common::AppState; diff --git a/src/modes/server/mcp/tools.rs b/src/modes/server/mcp/tools.rs index 62bfcfd..310a059 100644 --- a/src/modes/server/mcp/tools.rs +++ b/src/modes/server/mcp/tools.rs @@ -98,10 +98,11 @@ impl KeepTools { ]; for plugin_type in meta_plugins { + let plugin_type_clone = plugin_type.clone(); let mut plugin = get_meta_plugin(plugin_type); if plugin.is_supported() { if let Err(e) = plugin.initialize(&*conn, item_id) { - warn!("Failed to initialize plugin {:?}: {}", plugin_type, e); + warn!("Failed to initialize plugin {:?}: {}", plugin_type_clone, e); continue; } @@ -120,7 +121,7 @@ impl KeepTools { plugin.update(&buffer, &*conn); if let Err(e) = plugin.finalize(&*conn) { - warn!("Failed to finalize plugin {:?}: {}", plugin_type, e); + warn!("Failed to finalize plugin {:?}: {}", plugin_type_clone, e); } } } @@ -215,21 +216,19 @@ impl KeepTools { } pub async fn list_items(&self, args: Option) -> Result { - let tags: Vec = args - .as_ref() + let args_ref = args.as_ref(); + let tags: Vec = args_ref .and_then(|v| v.get("tags")) .and_then(|v| v.as_array()) .map(|arr| arr.iter().filter_map(|v| v.as_str().map(|s| s.to_string())).collect()) .unwrap_or_default(); - let limit = args - .as_ref() + let limit = args_ref .and_then(|v| v.get("limit")) .and_then(|v| v.as_u64()) .unwrap_or(10) as usize; - let offset = args - .as_ref() + let offset = args_ref .and_then(|v| v.get("offset")) .and_then(|v| v.as_u64()) .unwrap_or(0) as usize;