fix: resolve borrow and move errors and remove unused imports

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-23 13:06:04 -03:00
parent fb40809078
commit 0f156770f6
3 changed files with 8 additions and 10 deletions

View File

@@ -7,7 +7,6 @@ use futures::stream::{self, Stream};
use log::{debug, info}; use log::{debug, info};
use std::convert::Infallible; use std::convert::Infallible;
use std::time::Duration; use std::time::Duration;
use tokio_stream::StreamExt as _;
use crate::modes::server::common::AppState; use crate::modes::server::common::AppState;
use crate::modes::server::mcp::KeepMcpServer; use crate::modes::server::mcp::KeepMcpServer;

View File

@@ -1,5 +1,5 @@
use anyhow::Result; use anyhow::Result;
use log::{debug, warn}; use log::debug;
use serde_json::Value; use serde_json::Value;
use crate::modes::server::common::AppState; use crate::modes::server::common::AppState;

View File

@@ -98,10 +98,11 @@ impl KeepTools {
]; ];
for plugin_type in meta_plugins { for plugin_type in meta_plugins {
let plugin_type_clone = plugin_type.clone();
let mut plugin = get_meta_plugin(plugin_type); let mut plugin = get_meta_plugin(plugin_type);
if plugin.is_supported() { if plugin.is_supported() {
if let Err(e) = plugin.initialize(&*conn, item_id) { 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; continue;
} }
@@ -120,7 +121,7 @@ impl KeepTools {
plugin.update(&buffer, &*conn); plugin.update(&buffer, &*conn);
if let Err(e) = plugin.finalize(&*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<Value>) -> Result<String, ToolError> { pub async fn list_items(&self, args: Option<Value>) -> Result<String, ToolError> {
let tags: Vec<String> = args let args_ref = args.as_ref();
.as_ref() let tags: Vec<String> = args_ref
.and_then(|v| v.get("tags")) .and_then(|v| v.get("tags"))
.and_then(|v| v.as_array()) .and_then(|v| v.as_array())
.map(|arr| arr.iter().filter_map(|v| v.as_str().map(|s| s.to_string())).collect()) .map(|arr| arr.iter().filter_map(|v| v.as_str().map(|s| s.to_string())).collect())
.unwrap_or_default(); .unwrap_or_default();
let limit = args let limit = args_ref
.as_ref()
.and_then(|v| v.get("limit")) .and_then(|v| v.get("limit"))
.and_then(|v| v.as_u64()) .and_then(|v| v.as_u64())
.unwrap_or(10) as usize; .unwrap_or(10) as usize;
let offset = args let offset = args_ref
.as_ref()
.and_then(|v| v.get("offset")) .and_then(|v| v.get("offset"))
.and_then(|v| v.as_u64()) .and_then(|v| v.as_u64())
.unwrap_or(0) as usize; .unwrap_or(0) as usize;