From 65b619cd9b0caaed411042daee888a701ecff158 Mon Sep 17 00:00:00 2001 From: jordan Date: Tue, 3 Feb 2026 00:44:02 -0700 Subject: [PATCH] fix: clippy map_entry lint in eigentrust Co-Authored-By: Claude Opus 4.5 --- .../src/trust_graph_store/eigentrust.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/stemedb-storage/src/trust_graph_store/eigentrust.rs b/crates/stemedb-storage/src/trust_graph_store/eigentrust.rs index 4f05da9..a0814f9 100644 --- a/crates/stemedb-storage/src/trust_graph_store/eigentrust.rs +++ b/crates/stemedb-storage/src/trust_graph_store/eigentrust.rs @@ -68,20 +68,20 @@ pub fn compute_eigentrust_scores( let mut idx_to_agent: Vec<[u8; 32]> = Vec::new(); for edge in edges { - if !agent_to_idx.contains_key(&edge.from_agent) { - agent_to_idx.insert(edge.from_agent, idx_to_agent.len()); + if let std::collections::hash_map::Entry::Vacant(e) = agent_to_idx.entry(edge.from_agent) { + e.insert(idx_to_agent.len()); idx_to_agent.push(edge.from_agent); } - if !agent_to_idx.contains_key(&edge.to_agent) { - agent_to_idx.insert(edge.to_agent, idx_to_agent.len()); + if let std::collections::hash_map::Entry::Vacant(e) = agent_to_idx.entry(edge.to_agent) { + e.insert(idx_to_agent.len()); idx_to_agent.push(edge.to_agent); } } // Add seed agents that might not have edges for (agent, _) in seed_trust { - if !agent_to_idx.contains_key(agent) { - agent_to_idx.insert(*agent, idx_to_agent.len()); + if let std::collections::hash_map::Entry::Vacant(e) = agent_to_idx.entry(*agent) { + e.insert(idx_to_agent.len()); idx_to_agent.push(*agent); } }