From: Alice Ryhl <aliceryhl@google.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Mark Brown" <broonie@kernel.org>,
"Deborah Brouwer" <deborah.brouwer@collabora.com>,
dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org,
daniel.almeida@collabora.com, boris.brezillon@collabora.com
Subject: Re: [PATCH] drm/tyr: suppress unread field warnings
Date: Fri, 23 Jan 2026 15:10:14 +0000 [thread overview]
Message-ID: <aXOPVkAQGr0lEfml@google.com> (raw)
In-Reply-To: <CANiq72m9Nq-Wonw57Nwk480CTCmoaDk-_rTLX-dFrqh_N+eyfg@mail.gmail.com>
On Fri, Jan 23, 2026 at 04:01:42PM +0100, Miguel Ojeda wrote:
> On Thu, Jan 22, 2026 at 8:46 PM Danilo Krummrich <dakr@kernel.org> wrote:
> >
> > If I run 1.85.0, I *instead* see the following ones from clippy:
> >
> > CLIPPY [M] drivers/gpu/drm/tyr/tyr.o
> > warning: operator precedence can trip the unwary
> > --> drivers/gpu/drm/tyr/gpu.rs:51:13
> > |
> > 51 | shader_present | u64::from(regs::GPU_SHADER_PRESENT_HI.read(dev, iomem)?) << 32;
> > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider parenthesizing your expression: `shader_present | (u64::from(regs::GPU_SHADER_PRESENT_HI.read(dev, iomem)?) << 32)`
> > |
> > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence
> > = note: `-W clippy::precedence` implied by `-W clippy::all`
> > = help: to override `-W clippy::all` add `#[allow(clippy::precedence)]`
>
> I took a look at this -- Rust 1.85.0 extended the `precedence` lint
> to catch these, and then because it was too much, they split part of
> it into a new one called `precedence_bits` which is not enabled by
> default, which landed in Rust 1.86.0 (and is not in Rust 1.85.1,
> sadly).
>
> https://github.com/rust-lang/rust-clippy/pull/13743
> https://github.com/rust-lang/rust-clippy/issues/14097
> https://github.com/rust-lang/rust-clippy/pull/14115
>
> I see others in the kernel have written similar expressions with
> parenthesis, e.g. for Rust in `ioctl.rs`, and I see a ton of those in
> C files too.
>
> Personally, I don't mind seeing the parenthesis, but I know others may
> feel like it is obvious.
>
> Now, seeing quite a bunch of parenthesis for this in C files, from
> kernel devs and crypto stuff and all over drivers and so on and so
> forth, means others definitely do not find it obvious or prefer to be
> explicit for extra clarity.
>
> So we can just clean this one up and later enable `precedence_bits`
> for newer versions. Or if we decided it is too much, then I guess I
> could allow `precedence` on Rust 1.85.0 only.
>
> Cc'ing others in case they want to give their opinion.
Having a lint that happens on just one random version is inconvenient,
so I think we should take at least one of these two actions:
1. Disable clippy::precedence on 1.85.0 only.
2. Enable the clippy::precedence_bits lint.
But I am ok with enabling clippy::precedence_bits.
Alice
next prev parent reply other threads:[~2026-01-23 15:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 0:37 [PATCH] drm/tyr: suppress unread field warnings Deborah Brouwer
2026-01-22 0:58 ` Miguel Ojeda
2026-01-22 2:11 ` Deborah Brouwer
2026-01-22 11:22 ` Mark Brown
2026-01-22 19:46 ` Danilo Krummrich
2026-01-23 15:01 ` Miguel Ojeda
2026-01-23 15:10 ` Alice Ryhl [this message]
2026-01-23 15:24 ` Miguel Ojeda
2026-01-23 16:56 ` Gary Guo
2026-01-24 13:14 ` Miguel Ojeda
2026-01-22 8:42 ` Alice Ryhl
2026-01-22 19:05 ` Deborah Brouwer
2026-01-23 12:08 ` Alice Ryhl
2026-01-22 19:32 ` Gary Guo
2026-01-23 9:18 ` Alice Ryhl
2026-01-23 13:36 ` 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=aXOPVkAQGr0lEfml@google.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=broonie@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=deborah.brouwer@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=lossin@kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.