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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user