diff --git a/src/heap_element.rs b/src/heap_element.rs index d775fc9..527e33e 100644 --- a/src/heap_element.rs +++ b/src/heap_element.rs @@ -8,13 +8,13 @@ pub struct HeapElement { impl Ord for HeapElement { fn cmp(&self, other: &Self) -> Ordering { - self.partial_cmp(other).unwrap_or(Ordering::Equal) + self.distance.partial_cmp(&other.distance).unwrap_or(Ordering::Equal) } } impl PartialOrd for HeapElement { fn partial_cmp(&self, other: &Self) -> Option { - self.distance.partial_cmp(&other.distance) + Some(self.cmp(other)) } }