All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Erik Schilling" <erik.schilling@linaro.org>
To: "Kent Gibson" <warthog618@gmail.com>
Cc: <linux-gpio@vger.kernel.org>, <brgl@bgdev.pl>
Subject: Re: [libgpiod][PATCH] bindings: rust: fix clippy lint warnings
Date: Wed, 14 Jun 2023 11:16:50 +0200	[thread overview]
Message-ID: <CTC9DIU5X5C2.1M6232L22HH9K@fedora> (raw)
In-Reply-To: <ZImDFS2ATTxeFxDK@sol>

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


  reply	other threads:[~2023-06-14  9:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 15:40 [libgpiod][PATCH] bindings: rust: fix clippy lint warnings Kent Gibson
2023-06-14  8:14 ` Erik Schilling
2023-06-14  8:29   ` Kent Gibson
2023-06-14  8:40     ` Erik Schilling
2023-06-14  9:06       ` Kent Gibson
2023-06-14  9:16         ` Erik Schilling [this message]
2023-06-19  7:36     ` Erik Schilling
2023-06-19  7:49       ` Erik Schilling
2023-06-19  7:57       ` Kent Gibson
2023-06-19  8:13         ` Erik Schilling
2023-06-19  8:33           ` Kent Gibson
2023-06-19  8:50           ` Viresh Kumar
2023-06-19  8:59             ` Erik Schilling

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=CTC9DIU5X5C2.1M6232L22HH9K@fedora \
    --to=erik.schilling@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=linux-gpio@vger.kernel.org \
    --cc=warthog618@gmail.com \
    /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.