refactor: remove redundant multi-line search index unwrap clones across all handlers via new get_search_index accessor

This commit is contained in:
Riz Ashraf committed 2026-09-26 08:39:42 +01:00
1 parent d96b4cf822
commit 0ba0ed5b3d
5 files changed
+12 -36

No files matched your search

+2 -10
View File
@@ -37,11 +37,7 @@ impl McpTool for AddTaskHandler {
dependencies: deps,
acceptance_criteria: vec![],
};
let idx = state
.search_index
.read()
.unwrap_or_else(|e| e.into_inner())
.clone();
let idx = state.get_search_index();
drop(idx.index_task(&task));
state.tasks.modify(|tasks| {
tasks.push(task);
@@ -108,11 +104,7 @@ impl McpTool for DeleteTaskHandler {
});
if deleted_count > 0 {
let idx = state
.search_index
.read()
.unwrap_or_else(|e| e.into_inner())
.clone();
let idx = state.get_search_index();
for id in actually_deleted {
drop(idx.delete_document(&id));
}