Re: [libgpiod][PATCH] bindings: rust: fix clippy lint warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed Jun 14, 2023 at 11:06 AM CEST, Kent Gibson wrote:
> On Wed, Jun 14, 2023 at 10:40:56AM +0200, Erik Schilling wrote:
> > On Wed Jun 14, 2023 at 10:29 AM CEST, Kent Gibson wrote:
> > > On Wed, Jun 14, 2023 at 10:14:08AM +0200, Erik Schilling wrote:
> > > > On Mon Jun 12, 2023 at 5:40 PM CEST, Kent Gibson wrote:
> > > > > clippy from Rust 1.70 reports a host of warnings due to casting and type
> > > > > conversions across the FFI interface to libgpiod.
> > > > > These casts and conversions are required to support old versions of Rust
> > > > > that do not support recent Rust FFI extensions.
> > > > 
> > > > Could you elaborate which extensions are relevant here? Would it be
> > > > realistic to just update the minimum Rust version instead of needing
> > > > to include these suppression directives?
> > > > 
> > >
> > > Types were added in core::ffi[1] in 1.64 for just this purpose.
> > > e.g. c_uint[2]
> > > Though c_size_t[3] still remains in Experimental.
> > >
> > > And I guess the clippy lints followed soon after.
> > >
> > > Wrt setting the MSRV, but I assumed not, hence the allows.
> > 
> > For me bindgen seems to generate usize of size_t, thats why I asked.
> > Does that depend on the Rust version somehow? Or more concretely:
> > When will things like `gpiod_line_config_get_num_configured_offsets`
> > not get translated to `usize` so that we need a cast?
> > 
>
> No idea - outside my area.
>
> > On my end (with latest toolchain and nightly), I do not see any
> > clippy warnings with `cargo clippy`. How exactly did you produce those
> > warnings?
> > 
>
> Interesting.  With stable on libgpiod master in the rust/libgpiod
> directory, and with these in my environment:

Oh... My fault... I saw the -sys somewhere and tried to run things in
libgpiod-sys (after inspecting the generated bindings). Need to revisit
this in a calm moment.

Thanks for the additional detail!

- Erik





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux