From: "Benno Lossin" <lossin@kernel.org>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
"Gary Guo" <gary@garyguo.net>
Cc: "rust-for-linux" <rust-for-linux@vger.kernel.org>
Subject: Re: pin-init Clippy nightly trivial warning in 6.18.y
Date: Sun, 01 Mar 2026 21:06:00 +0100 [thread overview]
Message-ID: <DGRPSFTQAMBT.3CWVCXXAVET3X@kernel.org> (raw)
In-Reply-To: <CANiq72nWYJna_hdFxjQCQZK6yJBrr1Mb86iKavivV0U0BgufeA@mail.gmail.com>
On Sun Mar 1, 2026 at 7:30 PM CET, Miguel Ojeda wrote:
> Hi Benno, Gary,
>
> With nightly Clippy in 6.18.y, I am seeing a trivial warning, which I
> am wondering if we would want to keep enabled or not, i.e. I can see
> you may want to keep the `nesting` value check inside like you do in
> the nested `match nesting` below that one:
>
> 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 ~ }
> |
>
> Anyway, it is just in 6.18.y given the `syn` rewrite and not urgent
> since it is nightly.
>
> Please let me know what you think about the warning overall and for
> 6.18.y we can backport a targeted clean up.
I think we should just allow that lint here. I don't see the need to
shuffle around stable-tree code just to appease a clippy lint. Further,
I agree with Gary that if we were to do the fold, the code would become
harder to read. If we moved the condition into the guard, the pattern
could still "conceptually" match on the blanket arm below (it logically
can't because of the `!skip_until_comma`), but that's a thing that a
human has to parse. So even if we still had this code in mainline, I
would allow the lint there too.
Thanks for keeping the look out for pin-init on the stable trees & Rust
nightly!
Cheers,
Benno
next prev parent reply other threads:[~2026-03-01 20:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-01 18:30 pin-init Clippy nightly trivial warning in 6.18.y Miguel Ojeda
2026-03-01 18:39 ` Miguel Ojeda
2026-03-01 19:14 ` Gary Guo
2026-03-01 20:06 ` Benno Lossin [this message]
2026-03-01 20:19 ` Miguel Ojeda
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DGRPSFTQAMBT.3CWVCXXAVET3X@kernel.org \
--to=lossin@kernel.org \
--cc=gary@garyguo.net \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=rust-for-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox