Re: [PATCH] rust: rbtree: remove redundant comparison in find_best_match

From: Alice Ryhl

Date: Tue Dec 01 2026 - 08:32:20 EST


On Sat, Nov 21, 2026 at 08:16:18AM -0500, Joel Fernandes wrote:
> In the Less arm of find_best_match(), the current node was recorded as
> the best match only if its key was smaller than the key of the best
> match found so far. That test can never fail, so remove it. It saves a
> comparison and reduces lines of code.
>
> Signed-off-by: Joel Fernandes <jfern@xxxxxxxxxx>

Looks good to me! Since each `Ordering::Less` branch descends into the
left subtree, every subsequent candidate key is strictly smaller than the
previous best match by the BST invariant.

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>

Alice