clippy: fix all warnings across all binaries

- &PathBuf → &Path in memory-search.rs signatures
- Redundant field name in graph.rs struct init
- Add truncate(false) to lock file open
- Derive Default for Store instead of manual impl
- slice::from_ref instead of &[x.clone()]
- rsplit_once instead of split().last()
- str::repeat instead of iter::repeat().take().collect()
- is_none_or instead of map_or(true, ...)
- strip_prefix instead of manual slicing

Zero warnings on `cargo clippy`.
This commit is contained in:
ProofOfConcept 2026-02-28 23:47:11 -05:00
parent 7ee6f9c651
commit 29d5ed47a1
5 changed files with 15 additions and 27 deletions

View file

@ -44,7 +44,7 @@ fn find_current_transcript() -> Option<String> {
if p.extension().map(|x| x == "jsonl").unwrap_or(false) {
if let Ok(meta) = p.metadata() {
if let Ok(mtime) = meta.modified() {
if newest.as_ref().map_or(true, |(t, _)| mtime > *t) {
if newest.as_ref().is_none_or(|(t, _)| mtime > *t) {
newest = Some((mtime, p));
}
}
@ -554,8 +554,8 @@ fn cmd_apply_agent(args: &[String]) -> Result<(), String> {
let reason = link.get("reason").and_then(|v| v.as_str()).unwrap_or("");
// Skip NOTE: targets (new topics, not existing nodes)
if target.starts_with("NOTE:") {
println!(" NOTE: {}{}", &target[5..], reason);
if let Some(note) = target.strip_prefix("NOTE:") {
println!(" NOTE: {}{}", note, reason);
continue;
}
@ -932,12 +932,12 @@ fn cmd_write(args: &[String]) -> Result<(), String> {
let mut node = existing.clone();
node.content = content;
node.version += 1;
store.append_nodes(&[node.clone()])?;
store.append_nodes(std::slice::from_ref(&node))?;
store.nodes.insert(key.clone(), node);
println!("Updated '{}' (v{})", key, store.nodes[&key].version);
} else {
let node = capnp_store::Store::new_node(&key, &content);
store.append_nodes(&[node.clone()])?;
store.append_nodes(std::slice::from_ref(&node))?;
store.uuid_to_key.insert(node.uuid, node.key.clone());
store.nodes.insert(key.clone(), node);
println!("Created '{}'", key);