From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.71 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796131932; b=g0/yvBordkCXxJNYzDq6eh7WPzeX1xYCNYlKc0533Q08fX8xteAYfyOKBSjsASNJodWn wFevK/yT+aHzmzy7nMa/SxpMgtmmfcweQ5zfjpGf2db68SpxI7vvs7uq/q+7OOTzWLxdY 9GVykwoHYmq+ePpBIg1Zvo+mQ04lUWEhUb7xGuTBZ3xcY7ttzyOOurADXYelaFWZketB4 WhJJsGDBcCd6eblTma4lhmFAvpjMltx/PBQS8EfmT5UIMImCuhHVnuZCFPK+Let+Bf/yy ZdUHGCrot5JLzeFW//+m3p6yXHKDMX+MAla/HWhfZ66D30WUCPKgawt4ZogzkDH5GUA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796131932; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=HGSuzjCD14jry0omidbKDRD5Zjb1e8mTGFgMCQdOr1M=; b=zX/QX4JT5Rmh9rDqNLzYpwJ32EP2aR4vT6gsngPapNxl6SmCyn4lej+9XfoVmz4iSvyF H1TPitXgQqDQ7vTacxrMAtnRylvHeVuUrCMC9J9sQgn6o1k3RUkMnPSBf7D49Wuvndq8t GDTys9oNBvHstJ8S0q6O5PKg519q/AlJEZndZbYbRiVBrgLgVFzMJC9JMGgtYDR7FJSrD vGqiwVjr3uN2Qfj1tAE+9zE4zxNWMw6oUfSRo6TW0BOOz7Ffj/h9TePy5wgaVtvGLVi/4 rNh115TQFKdk4E2vRP9R62QvLVLM15Q5VVkzHZS07WAvgNSBYK60NE5IY75ZM766H9Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=PWTzbssv; arc=none smtp.remote-ip=209.85.128.71 Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A38C606A325 for ; Tue, 1 Dec 2026 13:32:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1A38C606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=PWTzbssv Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4ba078abd78so81735085e9.1 for ; Tue, 01 Dec 2026 05:32:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796131930; x=1796736730; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=HGSuzjCD14jry0omidbKDRD5Zjb1e8mTGFgMCQdOr1M=; b=PWTzbssvRoAQER1FjEf41GXGumW2LxdK+Z6/zKSZN/ki97QWUJVTrEPYzqqQiNztic +kWVfIdLxxtfyFHBVHP6GdkMeD4QYw5IL50EoFbC7yb0bRsBKHCqYcqBiQkope0+qm7P 1xsixqlhHy7wkxBsTaiuZwQ1YAjPoUHRuOUnyZshkbGqIFWZ4H0XvIbkM9xKCK/AVBxu RV2E507pUyRKnIGMbRuIkuO6xHcJ5x11l0471gj3kluHCe2J4rHJH3OINjBJdAaReLf7 QBbUsEdkk7/HmgcSOJkkDFbbikJeiMakCbGjFytv0Pwz4tVNiZljTFeQDjem8+2x42f2 zDUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796131930; x=1796736730; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=HGSuzjCD14jry0omidbKDRD5Zjb1e8mTGFgMCQdOr1M=; b=H6Ml18Lg0i3ZxiQtDcsXQZnn9BJOw2JbkGyo+y883L6HNWokRZGkLZvDniBTM3g54X BxR1pLIyCh05i4ltiX0zQ5TCzKZDVO/5vIaxLP5X9VBK/eYdtrHYUDGidysKv+Ep0xm1 UtwykQ8TB157BjiFtEIOPDBwLBGz3Sd+V73guHySETBkeGxXRBdOVdWOaFLTOd7QG+br BWXYYfJAeMMV7ngK6pGIIYLmESZHfd3ZHFqiE55YKY3EMO+vrddn62w+3h4GCF0GkNei A6e8B+s/dXIxgZyIZHpHapkB3WbZ5Ce8+Wbq+RupmG1vaVy6ptCwHDuWI97YV0fiS1KA tpKw== X-Forwarded-Encrypted: i=1; AL+hErEXoCTR34Icnxl8A5R/SNEVVVyqvFyhlfTVTI3Igb+e4m7B9Y0PqTgX5CFYHVzdsoZgkBgftPS1IuflHYM=@vger.kernel.org X-Gm-Message-State: APuU4Z/pPs+Nzn54MPeOD3Bmy57JjyU0negcxcZIOZ+DpUQbNQxLFykZ Sjviwu2VLqMj0a+1117c/lvOOnK5M5jCdlymnO+0bPqIMPfB2aGr6ANfdEPkj8wAuPA6Si9TCpB alRpCjDpN/IH4lI5pKw== X-Received: from wmbe17.prod.google.com ([2002:a05:600c:5911:b0:4a1:f90b:d923]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3ba9:b0:4a2:1050:aff with SMTP id 5b1f17b1804b1-4bb8881c741mr869123965e9.6.1796131930200; Tue, 01 Dec 2026 05:32:10 -0800 (PST) Date: Tue, 1 Dec 2026 13:32:09 +0000 In-Reply-To: <20261121131618.909529-1-jfern@kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261121131618.909529-1-jfern@kernel.org> X-Mailer: git-send-email 2.56.1.839.g22a8290db9-goog Message-ID: <20261201133209.2156799-1-aliceryhl@google.com> Subject: Re: [PATCH] rust: rbtree: remove redundant comparison in find_best_match From: Alice Ryhl To: Joel Fernandes Cc: Alice Ryhl , linux-kernel@vger.kernel.org, Miguel Ojeda , Boqun Feng , Gary Guo , "=?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?=" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , "=?UTF-8?q?Onur=20=C3=96zkan?=" , rust-for-linux@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 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 Alice