From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2248A346AE1 for ; Tue, 12 May 2026 20:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778616989; cv=none; b=Oy5muSxqfq29tDsaLmz5Z0MSZht+VwIQ4S2EAd4fHdBjhE+Y6wkQtmTB/6S7I+7KV+uGqBvkW3BmL7B3l3UQoh5acpZSWfn3m/UmJpFi3P7Xzc2KiX7KTryO5POoSNjC5egO2A8KP0T3KlhL1fflmz4KYFXXAKbNUalczQol1/Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778616989; c=relaxed/simple; bh=3buzGXSIF/aZCxyA1Llf+SGfH5ngp1NGlJH48ANGtDY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RTtv2HyOP+QpK/AHQ2mEAlvrMalLcRsxMfbI+RvFbkW/7ZVrasBO7BPPDP0mLQkBJe6kq6xk1gzOXaxCHb+y+SiBzJCYK7ITNF0wR/V3AXBis9wWenkLQ5OhVm3DhOEKC4hYKcGXUdZCoDgRe+09+pwo8j4X1invzAmbEtjD3tI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qT+IXMEY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qT+IXMEY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6BEEC2BCFA; Tue, 12 May 2026 20:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778616988; bh=3buzGXSIF/aZCxyA1Llf+SGfH5ngp1NGlJH48ANGtDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qT+IXMEYnVkxzyioArPQKgiJS43gy8KiDt1mBH1j8FR4kB8bmPDDTo2rjgK3RjBij 45HVfv3uDHGokyvBtA4GCa1PxkTObXoxBFJIlhkPc2kIFicIqGUCB5NHoRIn/9JfGy x67c059OBANeW+WaELPkODvq9Z7Ld//XsMro9dhM5sjNYM7+xkHeeRCQ8ELN3x9cgI 88WQmzUiFZBERrrDkJCotyr6yK6qcJ1T5GhkixPiLTTM2rsG9ysZYaeJFCCf8sqI29 wTDPcl13mnsAroxKQ10MmmxlYH6koMbgKRkH2LGlq2s2Mru9KRwj5HtSKqsmwW+Zf+ 4d0/bPkhHcANg== From: Miguel Ojeda To: stable@vger.kernel.org Cc: Miguel Ojeda , Gary Guo Subject: [PATCH 6.12.y] rust: allow `clippy::collapsible_match` globally Date: Tue, 12 May 2026 22:16:18 +0200 Message-ID: <20260512201618.304954-1-ojeda@kernel.org> In-Reply-To: <2026051200-blurred-frugality-a412@gregkh> References: <2026051200-blurred-frugality-a412@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The `clippy::collapsible_match` lint [1] can make code harder to read in certain cases [2], e.g. CLIPPY P rust/libmacros.so - due to command line change warning: this `if` can be collapsed into the outer `match` --> rust/pin-init/internal/src/helpers.rs:91:17 | 91 | / if nesting == 1 { 92 | | impl_generics.push(tt.clone()); 93 | | impl_generics.push(tt); 94 | | skip_until_comma = false; 95 | | } | |_________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match = note: `-W clippy::collapsible-match` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::collapsible_match)]` help: collapse nested if block | 90 ~ TokenTree::Punct(p) if skip_until_comma && p.as_char() == ',' 91 ~ && nesting == 1 => { 92 | impl_generics.push(tt.clone()); 93 | impl_generics.push(tt); 94 | skip_until_comma = false; 95 ~ } | The lint does not have much upside -- when the suggestion may be a good one, it would still read fine when nested anyway. And it is the kind of lint that may easily bias people to just apply the suggestion instead of allowing it. [ In addition, as Gary points out [3], the suggestion is also wrong [4] and in the process of being fixed [5], possibly for Rust 1.97.0: Link: https://lore.kernel.org/rust-for-linux/DI3YV94TH9I3.1SOHW51552497@garyguo.net/ [3] Link: https://github.com/rust-lang/rust-clippy/issues/16875 [4] Link: https://github.com/rust-lang/rust-clippy/pull/16878 [5] - Miguel ] Thus just let developers decide on their own. Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs). Link: https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match [1] Link: https://lore.kernel.org/rust-for-linux/CANiq72nWYJna_hdFxjQCQZK6yJBrr1Mb86iKavivV0U0BgufeA@mail.gmail.com/ [2] Reviewed-by: Gary Guo Link: https://patch.msgid.link/20260426144201.227108-1-ojeda@kernel.org Signed-off-by: Miguel Ojeda (cherry picked from commit 838d852da8503372f3a1779bfbd1ccb93153ab4e) Signed-off-by: Miguel Ojeda --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index e644f9a1fd5a..2c6b5339c471 100644 --- a/Makefile +++ b/Makefile @@ -453,6 +453,7 @@ export rust_common_flags := --edition=2021 \ -Wrust_2018_idioms \ -Wunreachable_pub \ -Wclippy::all \ + -Aclippy::collapsible_match \ -Wclippy::ignored_unit_patterns \ -Wclippy::mut_mut \ -Wclippy::needless_bitwise_bool \ -- 2.54.0