extract truncation helpers, fix clippy warnings, dedup batching loop
Add util::truncate() and util::first_n_chars() to replace 16 call sites doing the same floor_char_boundary or chars().take().collect() patterns. Deduplicate the batching loop in consolidate.rs (4 copies → 1 loop over an array). Fix all clippy warnings: redundant closures, needless borrows, collapsible if, unnecessary cast, manual strip_prefix. Net: -44 lines across 16 files.
This commit is contained in:
parent
e24dee6bdf
commit
52523403c5
16 changed files with 85 additions and 129 deletions
|
|
@ -104,7 +104,7 @@ fn job_experience_mine(ctx: &ExecutionContext, path: &str, segment: Option<usize
|
|||
let mut store = crate::store::Store::load()?;
|
||||
ctx.log_line("mining");
|
||||
let count = crate::enrich::experience_mine(&mut store, &path, segment)?;
|
||||
ctx.log_line(&format!("{} entries mined", count));
|
||||
ctx.log_line(format!("{count} entries mined"));
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ fn job_fact_mine(ctx: &ExecutionContext, path: &str) -> Result<(), TaskError> {
|
|||
let p = std::path::Path::new(&path);
|
||||
let progress = |msg: &str| { ctx.set_progress(msg); };
|
||||
let count = crate::fact_mine::mine_and_store(p, Some(&progress))?;
|
||||
ctx.log_line(&format!("{} facts stored", count));
|
||||
ctx.log_line(format!("{count} facts stored"));
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ fn job_knowledge_loop(ctx: &ExecutionContext) -> Result<(), TaskError> {
|
|||
};
|
||||
ctx.log_line("running agents");
|
||||
let results = crate::knowledge::run_knowledge_loop(&config)?;
|
||||
ctx.log_line(&format!("{} cycles, {} actions",
|
||||
ctx.log_line(format!("{} cycles, {} actions",
|
||||
results.len(),
|
||||
results.iter().map(|r| r.total_applied).sum::<usize>()));
|
||||
Ok(())
|
||||
|
|
@ -505,7 +505,7 @@ pub fn run_daemon() -> Result<(), String> {
|
|||
if extract_pending > 0 { parts.push(format!("{} extract", extract_pending)); }
|
||||
if fact_pending > 0 { parts.push(format!("{} fact", fact_pending)); }
|
||||
if still_open > 0 { parts.push(format!("{} open", still_open)); }
|
||||
ctx.set_progress(&parts.join(", "));
|
||||
ctx.set_progress(parts.join(", "));
|
||||
} else {
|
||||
ctx.set_progress("idle");
|
||||
}
|
||||
|
|
@ -575,7 +575,7 @@ pub fn run_daemon() -> Result<(), String> {
|
|||
digest.depend_on(&knowledge);
|
||||
|
||||
*last_daily_sched.lock().unwrap() = Some(today);
|
||||
ctx.set_progress(&format!("daily pipeline triggered ({})", today));
|
||||
ctx.set_progress(format!("daily pipeline triggered ({today})"));
|
||||
}
|
||||
|
||||
// Prune finished tasks from registry
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue