From 60187c9ba96bda40f5695889e11c5dfe7fb74166 Mon Sep 17 00:00:00 2001 From: Muhammad Mustaqeem Date: Mon, 3 Aug 2026 21:09:01 +0500 Subject: [PATCH] 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. --- crates/pi-natives/src/fd.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/pi-natives/src/fd.rs b/crates/pi-natives/src/fd.rs index cf4030d86..1f9ec8dc9 100644 --- a/crates/pi-natives/src/fd.rs +++ b/crates/pi-natives/src/fd.rs @@ -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); }