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

@ -384,11 +384,10 @@ impl Stage {
}
// Try algorithm parse first (bare words, no colon)
if !s.contains(':') {
if let Ok(algo) = AlgoStage::parse(s) {
if !s.contains(':')
&& let Ok(algo) = AlgoStage::parse(s) {
return Ok(Stage::Algorithm(algo));
}
}
// Algorithm with params: "spread,max_hops=4" (contains comma but no colon)
if s.contains(',') && !s.contains(':') {
@ -748,11 +747,10 @@ pub fn run_transform(
value += 1;
}
for (nbr, _) in graph.neighbors(k) {
if input_keys.contains(nbr.as_str()) {
if cover_count.get(nbr.as_str()).copied().unwrap_or(0) < REQUIRED_COVERAGE {
if input_keys.contains(nbr.as_str())
&& cover_count.get(nbr.as_str()).copied().unwrap_or(0) < REQUIRED_COVERAGE {
value += 1;
}
}
}
(k.clone(), value)
})
@ -814,7 +812,7 @@ pub fn match_seeds_opts(
key_map.insert(lkey.clone(), (key.to_owned(), weight as f64));
// Split key on hyphens, underscores, dots, hashes for component matching
for component in lkey.split(|c: char| c == '-' || c == '_' || c == '.' || c == '#') {
for component in lkey.split(['-', '_', '.', '#']) {
if component.len() >= 3 {
component_map.entry(component.to_owned())
.or_default()
@ -833,8 +831,8 @@ pub fn match_seeds_opts(
}
// Strategy 2: key component match (0.5× weight) — only when explicitly requested
if component_match {
if let Some(matches) = component_map.get(term.as_str()) {
if component_match
&& let Some(matches) = component_map.get(term.as_str()) {
for (orig_key, node_weight) in matches {
let score = term_weight * node_weight * 0.5;
*seed_map.entry(orig_key.clone()).or_insert(0.0) += score;
@ -842,7 +840,6 @@ pub fn match_seeds_opts(
}
continue;
}
}
// Strategy 3: content match (0.2× weight) — only when explicitly requested
if content_fallback {

View file

@ -393,11 +393,10 @@ fn execute_parsed(
for r in &mut results {
for f in &needed {
if !r.fields.contains_key(f) {
if let Some(v) = resolve_field(f, &r.key, store, graph) {
if !r.fields.contains_key(f)
&& let Some(v) = resolve_field(f, &r.key, store, graph) {
r.fields.insert(f.clone(), v);
}
}
}
}
@ -432,7 +431,7 @@ fn execute_parsed(
.map(|r| (r.key.clone(), graph.degree(&r.key) as f64))
.collect();
let xform = super::engine::Transform::DominatingSet;
items = super::engine::run_transform(&xform, items, store, &graph);
items = super::engine::run_transform(&xform, items, store, graph);
let keep: std::collections::HashSet<String> = items.into_iter().map(|(k, _)| k).collect();
results.retain(|r| keep.contains(&r.key));
}
@ -611,8 +610,8 @@ fn print_connectivity(results: &[QueryResult], graph: &Graph) {
println!(" {} (degree {})", node, graph.degree(node));
}
// Show a sample path between first two nodes
if component.len() >= 2 {
if let Some(path) = bfs_path(graph, &component[0], &component[1], max_hops) {
if component.len() >= 2
&& let Some(path) = bfs_path(graph, &component[0], &component[1], max_hops) {
print!(" path: ");
for (j, step) in path.iter().enumerate() {
if j > 0 { print!(""); }
@ -624,17 +623,15 @@ fn print_connectivity(results: &[QueryResult], graph: &Graph) {
}
println!();
}
}
}
}
// Suggest link-add commands for islands
if !islands.is_empty() {
if let Some(ref hub) = largest_cluster {
if !islands.is_empty()
&& let Some(ref hub) = largest_cluster {
println!("\nFix islands:");
for island in &islands {
println!(" poc-memory graph link-add {} {}", island, hub);
}
}
}
}