fix: resolve borrow of partially moved value errors and update error variant
Co-authored-by: aider (openai/andrew/openrouter/google/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -30,7 +30,7 @@ pub enum CoreError {
|
|||||||
impl From<rusqlite_migration::Error> for CoreError {
|
impl From<rusqlite_migration::Error> for CoreError {
|
||||||
fn from(err: rusqlite_migration::Error) -> Self {
|
fn from(err: rusqlite_migration::Error) -> Self {
|
||||||
match err {
|
match err {
|
||||||
rusqlite_migration::Error::Rusqlite(e) => CoreError::Database(e),
|
rusqlite_migration::Error::RusqliteError(e) => CoreError::Database(e),
|
||||||
e => CoreError::Other(e.into()),
|
e => CoreError::Other(e.into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,9 +154,10 @@ fn show_item_structured(
|
|||||||
data_path: PathBuf,
|
data_path: PathBuf,
|
||||||
output_format: OutputFormat,
|
output_format: OutputFormat,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
let item_tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
||||||
|
let meta_map = item_with_meta.meta_as_map();
|
||||||
let item = item_with_meta.item;
|
let item = item_with_meta.item;
|
||||||
let item_id = item.id.unwrap();
|
let item_id = item.id.unwrap();
|
||||||
let item_tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
|
||||||
|
|
||||||
let mut item_path_buf = data_path.clone();
|
let mut item_path_buf = data_path.clone();
|
||||||
item_path_buf.push(item_id.to_string());
|
item_path_buf.push(item_id.to_string());
|
||||||
@@ -172,8 +173,6 @@ fn show_item_structured(
|
|||||||
None => "Missing".to_string(),
|
None => "Missing".to_string(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let meta_map = item_with_meta.meta_as_map();
|
|
||||||
|
|
||||||
let item_info = ItemInfo {
|
let item_info = ItemInfo {
|
||||||
id: item_id,
|
id: item_id,
|
||||||
timestamp: item
|
timestamp: item
|
||||||
|
|||||||
@@ -70,9 +70,9 @@ pub fn mode_list(
|
|||||||
table.set_titles(title_row);
|
table.set_titles(title_row);
|
||||||
|
|
||||||
for item_with_meta in items_with_meta {
|
for item_with_meta in items_with_meta {
|
||||||
let item = item_with_meta.item;
|
|
||||||
let tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
let tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
||||||
let meta = item_with_meta.meta_as_map();
|
let meta = item_with_meta.meta_as_map();
|
||||||
|
let item = item_with_meta.item;
|
||||||
|
|
||||||
let mut item_path = data_path.clone();
|
let mut item_path = data_path.clone();
|
||||||
item_path.push(item.id.unwrap().to_string());
|
item_path.push(item.id.unwrap().to_string());
|
||||||
@@ -295,10 +295,10 @@ fn show_list_structured(
|
|||||||
let mut list_items = Vec::new();
|
let mut list_items = Vec::new();
|
||||||
|
|
||||||
for item_with_meta in items_with_meta {
|
for item_with_meta in items_with_meta {
|
||||||
let item = item_with_meta.item;
|
|
||||||
let item_id = item.id.unwrap();
|
|
||||||
let tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
let tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
||||||
let meta = item_with_meta.meta_as_map();
|
let meta = item_with_meta.meta_as_map();
|
||||||
|
let item = item_with_meta.item;
|
||||||
|
let item_id = item.id.unwrap();
|
||||||
|
|
||||||
let mut item_path = data_path.clone();
|
let mut item_path = data_path.clone();
|
||||||
item_path.push(item_id.to_string());
|
item_path.push(item_id.to_string());
|
||||||
|
|||||||
@@ -98,10 +98,10 @@ impl KeepTools {
|
|||||||
Err(e) => return Err(ToolError::Other(anyhow::Error::from(e))),
|
Err(e) => return Err(ToolError::Other(anyhow::Error::from(e))),
|
||||||
};
|
};
|
||||||
|
|
||||||
let item = item_with_content.item_with_meta.item;
|
|
||||||
let content = String::from_utf8_lossy(&item_with_content.content).to_string();
|
let content = String::from_utf8_lossy(&item_with_content.content).to_string();
|
||||||
let tags: Vec<String> = item_with_content.item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
let tags: Vec<String> = item_with_content.item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
||||||
let metadata = item_with_content.item_with_meta.meta_as_map();
|
let metadata = item_with_content.item_with_meta.meta_as_map();
|
||||||
|
let item = item_with_content.item_with_meta.item;
|
||||||
|
|
||||||
let response = serde_json::json!({
|
let response = serde_json::json!({
|
||||||
"id": item_id,
|
"id": item_id,
|
||||||
@@ -135,10 +135,10 @@ impl KeepTools {
|
|||||||
let item_id = item_with_meta.item.id.ok_or_else(|| anyhow!("Item missing ID after find"))?;
|
let item_id = item_with_meta.item.id.ok_or_else(|| anyhow!("Item missing ID after find"))?;
|
||||||
let item_with_content = service.get_item_content(item_id).await.map_err(|e| ToolError::Other(anyhow::Error::from(e)))?;
|
let item_with_content = service.get_item_content(item_id).await.map_err(|e| ToolError::Other(anyhow::Error::from(e)))?;
|
||||||
|
|
||||||
let item = item_with_content.item_with_meta.item;
|
|
||||||
let content = String::from_utf8_lossy(&item_with_content.content).to_string();
|
let content = String::from_utf8_lossy(&item_with_content.content).to_string();
|
||||||
let tags: Vec<String> = item_with_content.item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
let tags: Vec<String> = item_with_content.item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
||||||
let metadata = item_with_content.item_with_meta.meta_as_map();
|
let metadata = item_with_content.item_with_meta.meta_as_map();
|
||||||
|
let item = item_with_content.item_with_meta.item;
|
||||||
|
|
||||||
let response = serde_json::json!({
|
let response = serde_json::json!({
|
||||||
"id": item_id,
|
"id": item_id,
|
||||||
@@ -181,10 +181,10 @@ impl KeepTools {
|
|||||||
let items_info: Vec<_> = items_with_meta
|
let items_info: Vec<_> = items_with_meta
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|item_with_meta| {
|
.map(|item_with_meta| {
|
||||||
let item = item_with_meta.item;
|
|
||||||
let item_id = item.id.unwrap_or(0);
|
|
||||||
let item_tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
let item_tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
||||||
let item_meta = item_with_meta.meta_as_map();
|
let item_meta = item_with_meta.meta_as_map();
|
||||||
|
let item = item_with_meta.item;
|
||||||
|
let item_id = item.id.unwrap_or(0);
|
||||||
|
|
||||||
serde_json::json!({
|
serde_json::json!({
|
||||||
"id": item_id,
|
"id": item_id,
|
||||||
@@ -233,10 +233,10 @@ impl KeepTools {
|
|||||||
let items_info: Vec<_> = items_with_meta
|
let items_info: Vec<_> = items_with_meta
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|item_with_meta| {
|
.map(|item_with_meta| {
|
||||||
let item = item_with_meta.item;
|
|
||||||
let item_id = item.id.unwrap_or(0);
|
|
||||||
let item_tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
let item_tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
|
||||||
let item_meta = item_with_meta.meta_as_map();
|
let item_meta = item_with_meta.meta_as_map();
|
||||||
|
let item = item_with_meta.item;
|
||||||
|
let item_id = item.id.unwrap_or(0);
|
||||||
|
|
||||||
serde_json::json!({
|
serde_json::json!({
|
||||||
"id": item_id,
|
"id": item_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user