Implementation of Ord trait changed for Hit

- This will result in lexicographical ordering of facet in BinaryHeep in case of a tie
This commit is contained in:
Hardik Prajapati
2021-04-07 23:14:38 +05:30
parent 443aa17329
commit 50eea4376b

View File

@@ -37,7 +37,10 @@ impl<'a> PartialOrd<Hit<'a>> for Hit<'a> {
impl<'a> Ord for Hit<'a> {
fn cmp(&self, other: &Self) -> Ordering {
other.count.cmp(&self.count)
match other.count.cmp(&self.count) {
Ordering::Equal => self.facet.cmp(other.facet),
x => x,
}
}
}