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

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

View File

@@ -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<Value>) -> Result<String, ToolError> {
let tags: Vec<String> = args
.as_ref()
let args_ref = args.as_ref();
let tags: Vec<String> = 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;