refactor(fuzzy-find): release the heap borrow before evicting

Comparing against the heap root inside an `if let` binding keeps the shared
borrow of `heap` alive across the `pop`/`push` in the same block. Fold the
comparison into the condition instead, so the borrow ends with the
condition expression and eviction takes a clean mutable borrow.

No behavior change.
This commit is contained in:
Muhammad Mustaqeem
2026-08-03 21:09:01 +05:00
parent 2cf0a47d6a
commit 60187c9ba9
+1 -3
View File
@@ -227,9 +227,7 @@ impl TopMatches {
}
// The root is the worst retained candidate; replace it only when the new
// candidate outranks it under the final comparator.
if let Some(worst) = self.heap.peek()
&& candidate < *worst
{
if self.heap.peek().is_some_and(|worst| candidate < *worst) {
self.heap.pop();
self.heap.push(candidate);
}