Re: [PATCH] rust: cast to the proper type

From: Tamir Duberstein
Date: Wed Jun 11 2025 - 09:42:01 EST


On Wed, Jun 11, 2025 at 9:30 AM Tamir Duberstein <tamird@xxxxxxxxx> wrote:
>
> On Wed, Jun 11, 2025 at 7:42 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> >
> > On Wed, Jun 11, 2025 at 12:28 PM Tamir Duberstein <tamird@xxxxxxxxx> wrote:
> > >
> > > Use the ffi type rather than the resolved underlying type.
> > >
> > > Fixes: f20fd5449ada ("rust: core abstractions for network PHY drivers")
> >
> > Does this need to be backported? If not, I wouldn't include a Fixes tag.
>
> I'm fine with omitting it. I wanted to leave a breadcrumb to the
> commit that introduced the current code.
>
> >
> > > + DuplexMode::Full => bindings::DUPLEX_FULL,
> > > + DuplexMode::Half => bindings::DUPLEX_HALF,
> > > + DuplexMode::Unknown => bindings::DUPLEX_UNKNOWN,
> > > + } as crate::ffi::c_int;
> >
> > This file imports the prelude, so this can just be c_int without the
> > crate::ffI:: path.
>
> This has come up a few times now; should we consider denying
> unused_qualifications?
>
> https://doc.rust-lang.org/stable/nightly-rustc/rustc_lint/builtin/static.UNUSED_QUALIFICATIONS.html

I should point out also that every reference to crate::ffi::c_int in
this file is fully qualified, so I think this should be a separate
change.