cleanup: auto-fix clippy warnings in poc-memory

Applied cargo clippy --fix for collapsible_if, manual_char_comparison,
and other auto-fixable warnings.
This commit is contained in:
Kent Overstreet 2026-03-21 19:42:38 -04:00
parent 3640de444b
commit 653da40dcd
21 changed files with 99 additions and 149 deletions

View file

@ -75,13 +75,11 @@ pub fn digest_parent(store: &Store, key: &str) -> Option<String> {
// Look for structural links first (digest:structural provenance)
for r in &store.relations {
if r.deleted { continue; }
if r.source_key == key {
if let Some(target) = store.nodes.get(&r.target_key) {
if target.node_type == parent_type {
if r.source_key == key
&& let Some(target) = store.nodes.get(&r.target_key)
&& target.node_type == parent_type {
return Some(r.target_key.clone());
}
}
}
}
// Fallback: match by date for journal→daily
@ -92,8 +90,8 @@ pub fn digest_parent(store: &Store, key: &str) -> Option<String> {
dates.push(store::format_date(node.timestamp));
}
// Extract date from key patterns like "journal#2026-03-03-..." or "journal#j-2026-03-13t..."
if let Some(rest) = key.strip_prefix("journal#j-").or_else(|| key.strip_prefix("journal#")) {
if rest.len() >= 10 {
if let Some(rest) = key.strip_prefix("journal#j-").or_else(|| key.strip_prefix("journal#"))
&& rest.len() >= 10 {
let candidate = &rest[..10];
if candidate.chars().nth(4) == Some('-') {
let date = candidate.to_string();
@ -102,7 +100,6 @@ pub fn digest_parent(store: &Store, key: &str) -> Option<String> {
}
}
}
}
for date in &dates {
for prefix in [&format!("daily-{}", date), &format!("digest#daily#{}", date)] {
for (k, n) in &store.nodes {
@ -133,13 +130,11 @@ pub fn digest_children(store: &Store, key: &str) -> Vec<String> {
let mut children: Vec<(String, i64)> = Vec::new();
for r in &store.relations {
if r.deleted { continue; }
if r.target_key == key {
if let Some(source) = store.nodes.get(&r.source_key) {
if source.node_type == child_type {
if r.target_key == key
&& let Some(source) = store.nodes.get(&r.source_key)
&& source.node_type == child_type {
children.push((r.source_key.clone(), source.timestamp));
}
}
}
}
// Fallback for daily → journal: extract date from key and match
@ -225,26 +220,23 @@ pub fn show(store: &Store) -> Result<(), String> {
// Temporal context
let (prev, next) = temporal_neighbors(store, &key);
eprintln!();
if let Some(ref p) = prev {
if let Some(pn) = store.nodes.get(p) {
if let Some(ref p) = prev
&& let Some(pn) = store.nodes.get(p) {
eprintln!("{}", node_summary(pn));
eprintln!(" `cursor back`");
}
}
if let Some(ref n) = next {
if let Some(nn) = store.nodes.get(n) {
if let Some(ref n) = next
&& let Some(nn) = store.nodes.get(n) {
eprintln!("{}", node_summary(nn));
eprintln!(" `cursor forward`");
}
}
// Hierarchy
if let Some(ref parent) = digest_parent(store, &key) {
if let Some(pn) = store.nodes.get(parent) {
if let Some(ref parent) = digest_parent(store, &key)
&& let Some(pn) = store.nodes.get(parent) {
eprintln!("{}", node_summary(pn));
eprintln!(" `cursor up`");
}
}
let children = digest_children(store, &key);
if !children.is_empty() {
let count = children.len();