From dc4af4c146137fa770c8ac024180204cee344ecf Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Sun, 27 Jun 2021 16:46:08 -0700 Subject: [PATCH] Only hash Node rather than the index too --- src/ucs.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ucs.rs b/src/ucs.rs index fdd0a5c21..bbb81dfbe 100644 --- a/src/ucs.rs +++ b/src/ucs.rs @@ -182,11 +182,9 @@ impl<'a> Hash for GraphNode<'a> { fn hash(&self, state: &mut H) { // Deliberately ignore distance: we want to find equal nodes // regardless of the distance of different paths to them. - self.lhs_next.hash(state); - self.rhs_next.hash(state); - - // next_idx fields are unnecessary: they're unique to the - // current node fields and just used for convenience of - // traversing. + let lhs_node = self.lhs_next.as_ref().map(|(n, _)| n); + let rhs_node = self.rhs_next.as_ref().map(|(n, _)| n); + lhs_node.hash(state); + rhs_node.hash(state); } }