score_details: short circuit when the order has been established

This commit is contained in:
Louis Dureuil 2023-06-09 08:33:13 +02:00
parent da138deaf7
commit 3115af9baf
No known key found for this signature in database

View File

@ -212,8 +212,12 @@ impl ScoreDetails {
_ => return Ok(Ordering::Equal),
};
for (left, right) in left.zip(right) {
if order != Ordering::Equal {
return Ok(order);
};
index += 1;
order = order.then(left.partial_cmp(right).incomparable(index)?);
order = left.partial_cmp(right).incomparable(index)?;
}
Ok(order)
}