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 EBFFE2D781B; Sun, 26 Apr 2026 14:42:18 +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=1777214539; cv=none; b=Wxu9CAVp5ttVaOxnxy5SPAaXktd2NcLY4AwTeaCDklj60LqeAkKskqQ/awqB8rZGGDjOMV6/iI5y0nK6rscN92ZRSV45eLKJOWMowVe8Q9/mvQh8QOCGoL2mGSJIB16CE/8ga/9/6H+bgRAaBNuBjN4wKVn8jiFC+X9qSYagHfY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777214539; c=relaxed/simple; bh=ofg3lMesQh9T3z7a6xvFc19GqPAawfrOV0vF6sL54PY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=t6P7qr7muN9DfwtO5xWkJsc2Fo+GQZ7NP3r/meppGD5bUPty83pw8OnO3A7SALT58384sxjywEtz/sng3vfyIifSGcGtQFtbJpBZd3+EWJ41l3lUFV2VWteyBuE8PIypJUHI8zAgwkpgLMhW4NTEXpeN2nHX73vlTwg5msiQKYE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fgexN8Kr; 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="fgexN8Kr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F9F1C2BCAF; Sun, 26 Apr 2026 14:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777214538; bh=ofg3lMesQh9T3z7a6xvFc19GqPAawfrOV0vF6sL54PY=; h=From:To:Cc:Subject:Date:From; b=fgexN8KrBqDlVC+Gs2F6I/1WFLEOf6IOzw0H4Tj1iPyNQFFky40stM4T5bjTWm8iW MYrrHgo6OIYbOoQ1xGTrqQYxztxY2P+sNvPN3sPjxEnXSXN5YRIRcWMx6eWr9jwFY/ BuqTibpaDCq9xuQ3qnQVa6byarnSHjkxXGF5muloIbHTlekFTE+/dnXsKc3moFXfK5 XCZ58zeCE/p2rN32WpzcJrZJLPDeoJRJmxzZZYAQub9mUsaWTTKHfjkhFbuhdWAiZp 5YgKIl+KpFRIVYHbAfSEs93OFvzAm1raIX8PbEIP7e4+wdodjUiEp/PUf+4VMmUtTi RUfpW5TxLUd5A== From: Miguel Ojeda To: Miguel Ojeda , Greg Kroah-Hartman , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Christian Brauner , Carlos Llamas , Alice Ryhl , Nathan Chancellor , Nicolas Schier Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 1/2] rust: allow `clippy::collapsible_match` globally Date: Sun, 26 Apr 2026 16:42:00 +0200 Message-ID: <20260426144201.227108-1-ojeda@kernel.org> 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. 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] Signed-off-by: Miguel Ojeda --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 54e1ae602000..e2a810bc4409 100644 --- a/Makefile +++ b/Makefile @@ -486,6 +486,7 @@ export rust_common_flags := --edition=2021 \ -Wclippy::as_ptr_cast_mut \ -Wclippy::as_underscore \ -Wclippy::cast_lossless \ + -Aclippy::collapsible_match \ -Wclippy::ignored_unit_patterns \ -Aclippy::incompatible_msrv \ -Wclippy::mut_mut \ base-commit: 897d54018cc9aa97fd1529ca08a53b429d05a566 -- 2.53.0