From: FUJITA Tomonori <fujita.tomonori@gmail.com>
To: tamird@gmail.com
Cc: masahiroy@kernel.org, nathan@kernel.org, ojeda@kernel.org,
alex.gaynor@gmail.com, boqun.feng@gmail.com, gary@garyguo.net,
bjorn3_gh@protonmail.com, a.hindborg@kernel.org,
aliceryhl@google.com, tmgross@umich.edu, dakr@kernel.org,
gregkh@linuxfoundation.org, rafael@kernel.org,
brendan.higgins@linux.dev, davidgow@google.com, rmoar@google.com,
bhelgaas@google.com, mcgrof@kernel.org, russ.weight@linux.dev,
robh@kernel.org, saravanak@google.com, abdiel.janulgue@gmail.com,
daniel.almeida@collabora.com, robin.murphy@arm.com,
maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch,
fujita.tomonori@gmail.com, nicolas.schier@linux.dev,
frederic@kernel.org, lyude@redhat.com, tglx@linutronix.de,
anna-maria@linutronix.de, lossin@kernel.org,
kwilczynski@kernel.org, jstultz@google.com, sboyd@kernel.org,
lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com,
leitao@debian.org, viresh.kumar@linaro.org,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org, linux-kselftest@vger.kernel.org,
kunit-dev@googlegroups.com, linux-pci@vger.kernel.org,
linux-block@vger.kernel.org, devicetree@vger.kernel.org,
dri-devel@lists.freedesktop.org, netdev@vger.kernel.org,
linux-mm@kvack.org, linux-pm@vger.kernel.org,
nouveau@lists.freedesktop.org
Subject: Re: [PATCH v12 5/6] rust: enable `clippy::cast_lossless` lint
Date: Thu, 19 Jun 2025 14:18:17 +0900 (JST) [thread overview]
Message-ID: <20250619.141817.2042938522863410452.fujita.tomonori@gmail.com> (raw)
In-Reply-To: <20250615-ptr-as-ptr-v12-5-f43b024581e8@gmail.com>
On Sun, 15 Jun 2025 16:55:09 -0400
Tamir Duberstein <tamird@gmail.com> wrote:
> Before Rust 1.29.0, Clippy introduced the `cast_lossless` lint [1]:
>
>> Rust’s `as` keyword will perform many kinds of conversions, including
>> silently lossy conversions. Conversion functions such as `i32::from`
>> will only perform lossless conversions. Using the conversion functions
>> prevents conversions from becoming silently lossy if the input types
>> ever change, and makes it clear for people reading the code that the
>> conversion is lossless.
>
> While this doesn't eliminate unchecked `as` conversions, it makes such
> conversions easier to scrutinize. It also has the slight benefit of
> removing a degree of freedom on which to bikeshed. Thus apply the
> changes and enable the lint -- no functional change intended.
>
> Link: https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless [1]
> Suggested-by: Benno Lossin <benno.lossin@proton.me>
> Link: https://lore.kernel.org/all/D8ORTXSUTKGL.1KOJAGBM8F8TN@proton.me/
> Reviewed-by: Benno Lossin <benno.lossin@proton.me>
> Reviewed-by: Boqun Feng <boqun.feng@gmail.com>
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
> Makefile | 1 +
> drivers/gpu/drm/drm_panic_qr.rs | 4 ++--
> drivers/gpu/nova-core/regs.rs | 2 +-
> drivers/gpu/nova-core/regs/macros.rs | 2 +-
> rust/bindings/lib.rs | 1 +
> rust/kernel/net/phy.rs | 4 ++--
> rust/uapi/lib.rs | 1 +
> 7 files changed, 9 insertions(+), 6 deletions(-)
For PHY part:
Acked-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
next prev parent reply other threads:[~2025-06-19 5:18 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-15 20:55 [PATCH v12 0/6] rust: reduce `as` casts, enable related lints Tamir Duberstein
2025-06-15 20:55 ` [PATCH v12 1/6] rust: enable `clippy::ptr_as_ptr` lint Tamir Duberstein
2025-06-18 13:53 ` Tamir Duberstein
2025-06-18 16:45 ` Miguel Ojeda
2025-06-18 17:17 ` Tejun Heo
2025-06-18 17:44 ` Danilo Krummrich
2025-06-18 17:57 ` Tamir Duberstein
2025-06-18 17:57 ` Miguel Ojeda
2025-06-19 4:30 ` Greg Kroah-Hartman
2025-06-18 16:48 ` Miguel Ojeda
2025-06-19 5:53 ` Viresh Kumar
2025-06-15 20:55 ` [PATCH v12 2/6] rust: enable `clippy::ptr_cast_constness` lint Tamir Duberstein
2025-06-18 17:31 ` Miguel Ojeda
2025-06-15 20:55 ` [PATCH v12 3/6] rust: enable `clippy::as_ptr_cast_mut` lint Tamir Duberstein
2025-06-18 17:29 ` Miguel Ojeda
2025-06-19 4:30 ` Greg KH
2025-06-15 20:55 ` [PATCH v12 4/6] rust: enable `clippy::as_underscore` lint Tamir Duberstein
2025-06-18 13:50 ` Tamir Duberstein
2025-06-18 17:04 ` Miguel Ojeda
2025-06-19 4:30 ` Greg KH
2025-06-18 17:37 ` Danilo Krummrich
2025-06-18 17:50 ` Miguel Ojeda
2025-06-18 17:56 ` Tamir Duberstein
2025-06-18 17:58 ` Miguel Ojeda
2025-06-15 20:55 ` [PATCH v12 5/6] rust: enable `clippy::cast_lossless` lint Tamir Duberstein
2025-06-18 13:51 ` Tamir Duberstein
2025-06-18 17:06 ` Miguel Ojeda
2025-06-18 17:40 ` Jocelyn Falempe
2025-06-19 5:18 ` FUJITA Tomonori [this message]
2025-06-15 20:55 ` [PATCH v12 6/6] rust: enable `clippy::ref_as_ptr` lint Tamir Duberstein
2025-06-18 17:27 ` Miguel Ojeda
2025-06-22 22:50 ` [PATCH v12 0/6] rust: reduce `as` casts, enable related lints 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=20250619.141817.2042938522863410452.fujita.tomonori@gmail.com \
--to=fujita.tomonori@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=a.hindborg@kernel.org \
--cc=abdiel.janulgue@gmail.com \
--cc=airlied@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=anna-maria@linutronix.de \
--cc=bhelgaas@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=brendan.higgins@linux.dev \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=davidgow@google.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=frederic@kernel.org \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=jstultz@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=kwilczynski@kernel.org \
--cc=leitao@debian.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=masahiroy@kernel.org \
--cc=mcgrof@kernel.org \
--cc=mripard@kernel.org \
--cc=nathan@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.schier@linux.dev \
--cc=nouveau@lists.freedesktop.org \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rmoar@google.com \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=russ.weight@linux.dev \
--cc=rust-for-linux@vger.kernel.org \
--cc=saravanak@google.com \
--cc=sboyd@kernel.org \
--cc=simona@ffwll.ch \
--cc=tamird@gmail.com \
--cc=tglx@linutronix.de \
--cc=tmgross@umich.edu \
--cc=tzimmermann@suse.de \
--cc=viresh.kumar@linaro.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