Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

style: clear the remaining clippy 1.97 lints (-D warnings green)

xerj-org045225ed2f66
diff --git a/engine/crates/xerj-ai/src/neural.rs b/engine/crates/xerj-ai/src/neural.rs
index d8036dead..90074e88b 100644
--- a/engine/crates/xerj-ai/src/neural.rs
+++ b/engine/crates/xerj-ai/src/neural.rs
@@ -103,7 +103,7 @@ impl NeuralEmbedder {
// Safetensors is memory-mapped; the file must outlive the model, which
// it does (candle copies tensors into the VarBuilder-backed model).
let vb = unsafe {
- VarBuilder::from_mmaped_safetensors(&[weights_path.clone()], DTYPE, &device)
+ VarBuilder::from_mmaped_safetensors(std::slice::from_ref(&weights_path), DTYPE, &device)
.with_context(|| format!("map weights {}", weights_path.display()))?
};
let model = BertModel::load(vb, &config).map_err(|e| anyhow!("load BERT model: {e}"))?;
diff --git a/engine/crates/xerj-common/src/config.rs b/engine/crates/xerj-common/src/config.rs
index de2b4964c..833bc8e00 100644
--- a/engine/crates/xerj-common/src/config.rs
+++ b/engine/crates/xerj-common/src/config.rs
@@ -385,7 +385,7 @@ impl LoggingConfig {
/// `allowed_origins = ["https://app.example.com"]`. Set
/// `allow_any_origin = true` **only** for local development to restore the old
/// wide-open behavior.
-#[derive(Debug, Clone, Serialize, Deserialize)]
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default, deny_unknown_fields)]
pub struct CorsConfig {
/// Explicit allow-list of browser `Origin`s permitted to make cross-origin
@@ -400,15 +400,6 @@ pub struct CorsConfig {
pub allow_any_origin: bool,
}
-impl Default for CorsConfig {
- fn default() -> Self {
- Self {
- allowed_origins: Vec::new(),
- allow_any_origin: false,
- }
- }
-}
-
// ─────────────────────────────────────────────────────────────────────────────
/// TLS settings.
diff --git a/engine/crates/xerj-engine/src/fast_aggs.rs b/engine/crates/xerj-engine/src/fast_aggs.rs
index 013381f05..88ea58da3 100644
--- a/engine/crates/xerj-engine/src/fast_aggs.rs
+++ b/engine/crates/xerj-engine/src/fast_aggs.rs
@@ -4734,6 +4734,7 @@ enum Pred {
/// * date fields — true for the canonical fixed-width RFC3339
/// `%Y-%m-%dT%H:%M:%S%.3fZ` form the query parser emits and the
/// ingest path normalises to.
+ ///
/// `resolve_pred` enforces that invariant per segment and bails to brute
/// on any dictionary that is not uniformly canonical, so a mixed-width
/// column (e.g. hand-indexed `"2026-06-01"` alongside full timestamps)
diff --git a/engine/crates/xerj-engine/tests/integration.rs b/engine/crates/xerj-engine/tests/integration.rs
index e20d999be..ed8042035 100644
--- a/engine/crates/xerj-engine/tests/integration.rs
+++ b/engine/crates/xerj-engine/tests/integration.rs
@@ -4684,10 +4684,10 @@ async fn test_fused_memtable_total_matches_shortcut_recount() {
let mk_doc = |i: usize, wave: &str| {
let mut d = json!({
- "status": if i % (if wave == "seg" { 2 } else { 3 }) == 0 { "ok" } else { "error" },
+ "status": if i.is_multiple_of(if wave == "seg" { 2 } else { 3 }) { "ok" } else { "error" },
"latency_ms": i * if wave == "seg" { 10 } else { 7 },
// multi-valued numeric on every 4th doc, scalar otherwise
- "codes": if i % 4 == 0 { json!([i, i + 100]) } else { json!(i) },
+ "codes": if i.is_multiple_of(4) { json!([i, i + 100]) } else { json!(i) },
});
// MISSING field on every 5th doc (ES "missing value" semantics: the
// doc matches no range on the field). Deliberately the ABSENT-KEY
@@ -4700,7 +4700,7 @@ async fn test_fused_memtable_total_matches_shortcut_recount() {
// and is recorded in demo/playbooks/ES_COMPATIBILITY.md; absent-key
// docs (this flavour) agree with ES exactly (29/29/29 live-verified
// on both engines).
- if i % 5 != 0 {
+ if !i.is_multiple_of(5) {
d["cost_usd"] = json!((i as f64) * 0.01);
}
d
diff --git a/engine/crates/xerj-vector/src/hnsw.rs b/engine/crates/xerj-vector/src/hnsw.rs
index 96ca527be..db0ec23d5 100644
--- a/engine/crates/xerj-vector/src/hnsw.rs
+++ b/engine/crates/xerj-vector/src/hnsw.rs
@@ -976,6 +976,7 @@ impl HnswIndex {
/// Graph structure summary: (entry_point, entry_layer, level histogram,
/// layer-0 out-degree histogram, layer-0 BFS reachable-node count from
/// the entry point).
+ #[allow(clippy::type_complexity)]
pub fn debug_structure(
&self,
) -> (