chore: rustfmt, clippy lints and code tidying

This commit is contained in:
Riz Ashraf committed 2026-09-17 15:35:41 +01:00
1 parent 3716c3e698
commit 1752753fcc
19 files changed
+1273 -738

No files matched your search

+13 -8
View File
@@ -28,7 +28,8 @@ impl MemoryIndex {
let index_dir = store_dir.join("tantivy_index");
std::fs::create_dir_all(&index_dir).unwrap();
let index = Index::open_in_dir(&index_dir).unwrap_or_else(|_| Index::create_in_dir(&index_dir, schema.clone()).unwrap());
let index = Index::open_in_dir(&index_dir)
.unwrap_or_else(|_| Index::create_in_dir(&index_dir, schema.clone()).unwrap());
let writer = index.writer(50_000_000)?;
let reader = index
@@ -72,7 +73,6 @@ impl MemoryIndex {
Ok(())
}
pub fn commit(&self) -> tantivy::Result<()> {
let mut writer = self.writer.lock().unwrap();
writer.commit()?;
@@ -113,9 +113,11 @@ impl MemoryIndex {
.and_then(|v| v.as_str())
.unwrap_or("");
if let Some(ns) = namespace
&& doc_ns != ns && doc_ns != "global" {
continue;
}
&& doc_ns != ns
&& doc_ns != "global"
{
continue;
}
results.push((id, doc_type));
}
Ok(results)
@@ -172,7 +174,10 @@ mod tests {
status: "open".to_string(),
created_at: 0,
updated_at: 0,
git_branch: None, acceptance_criteria: vec![], dependencies: vec![], parent_id: None,
git_branch: None,
acceptance_criteria: vec![],
dependencies: vec![],
parent_id: None,
};
index.index_task(&task).unwrap();
@@ -218,11 +223,11 @@ mod tests {
fn test_search_malformed_query() {
let temp_dir = TempDir::new().unwrap();
let index = MemoryIndex::new(temp_dir.path()).unwrap();
// Malformed lucene query (unclosed parenthesis)
let result = index.search("title: (unclosed", None);
assert!(result.is_err());
// Another malformed query (unclosed quote)
let result2 = index.search("title: \"unclosed", None);
assert!(result2.is_err());