From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.69 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796131932; b=wGitBOGapO3VOzq9w+2Kyj4bRmFFyg+8KMQgLRoS5jnZCt5NusAeTAgBFxxky7wxy6+i s06Zi+zOrMya5aSnS7Bcg853boMLf9SyfzorOBU4K7tQVJCmMigQjRC2sjsEehBn5BH74 ukafB4UjysG1qI2IXHGmP44CTrS+60+hZ5gtIqkH9hAwAnOlDD9ciP3QdWDAo78Wu10JJ 2UGMsgaGZdRWdpkfoaOYDJrbkVTdsN27AixoZXYZj+eeksjbEnP1+j8gNAqoIB0Xm31oS ltdwPolss1JxsG4GMW9XPtEmi0qAlRSVmgjNG7EsIDu4Byxqk/54oUpKFakldK+fCpA== 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=sNV+o76PERDZ3OXtxaY7tpev9maEsk1cYQwuktrEE0oLriiX69TRsG/WpjIIg/k4JJOf 0kgzpu5rI/592hRy58Ke8I2RNshMXcw/xqILHJGtchqpcO0XVADaM8u+hqbheFEyhvreV 3RiZCrCRyEks4WmynFSXTDfsHGDyTCBxou1q/9/ToRujaiRtNU/97I0Bmg3jICqE4Fg5+ ny3lHKby8UviDVqvw+k3rSGNR9xGXg/bbGV4DHnV5n8rtfcEPGbmYu6LKoWdy3/3EAqmk LA7Zrvbb6y6o4iXusBfj8V/Xr6LMz3fuvKBnk8DGy0X+t43UwhDX9SULCk25ksLfxgA== 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.69 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (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 1830D606A320 for ; Tue, 1 Dec 2026 13:32:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1830D606A320 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, unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=PWTzbssv Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4ba078abd78so81735105e9.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=xzsJFkOSMVxMX42Zs/QnZ+rrkEVp4EUAAwhIo8C9sqXejVVxE39zhLw7q4Nt9xM7E3 ptg2+g6R6ryJoOCLS/H7foinnO6kZgRWJN2kCEF0UkU64JaYVuXEeZ8Vc4FDEieTX34I Du1Sm+b/rLRNyZO0tDZi65l7ELkbfWNKX6Mmect2sx+nWIFcc2DjEw4TFoJveOJfs+31 chRdTiVzErRsGLkIhlPZ4u+IHaGnbu+1hGaLa2SJ58ugF8tYgmHw5xU0Dqp68pZtGkGo yUhG4IY0Hhi8TD2WcN8WHU7iW/Qn1xr/ON2NJfEN9cghL9Emr67KIYxpxCudaQVGRzEP /b5g== X-Forwarded-Encrypted: i=1; AL+hErGCyLsB2+RN1A3FsyBJLq+ayB8Tc/7FLYIUmRBie7rD6gdNgigVarKtT2PYjPKLthIfKUc3jk4kMBYx5YDZnA==@vger.kernel.org X-Gm-Message-State: APuU4Z/Wgm0bMLklYbT/Fm6/70F0iIWq+gm95kluU2xWDytTeDsSUsdu wcvSldPl3kDPco9PVCP8IoxCs6dTytth35Td1EnVyY8/6941i+mWBMR1LrIdQjIw26IkCa1NtNY VDO3fVPiodKTDDA9Iyw== 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: rust-for-linux@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