On Sun, 15 Jun 2025 16:55:09 -0400 Tamir Duberstein <[email protected]> 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 <[email protected]> > Link: https://lore.kernel.org/all/[email protected]/ > Reviewed-by: Benno Lossin <[email protected]> > Reviewed-by: Boqun Feng <[email protected]> > Signed-off-by: Tamir Duberstein <[email protected]> > --- > 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 <[email protected]>
