From: Erik Schilling <erik.schilling@linaro.org>
To: Linux-GPIO <linux-gpio@vger.kernel.org>
Cc: Kent Gibson <warthog618@gmail.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Erik Schilling <erik.schilling@linaro.org>
Subject: [libgpiod][PATCH v2 2/4] bindings: rust: clippy: silence false-positives on casts
Date: Fri, 30 Jun 2023 13:18:45 +0200 [thread overview]
Message-ID: <20230630-clippy-v2-2-f44447925ad6@linaro.org> (raw)
In-Reply-To: <20230630-clippy-v2-0-f44447925ad6@linaro.org>
clippy falsely complains about these lines. The problem is known, but
unfixed [1]. So lets silence the warning until a fix is widely available.
clippy version: clippy 0.1.70 (90c5418 2023-05-31).
[1] https://github.com/rust-lang/rust-clippy/issues/10555
Reported-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20230612154055.56556-1-warthog618@gmail.com
Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
---
bindings/rust/libgpiod/src/line_info.rs | 3 +++
bindings/rust/libgpiod/src/line_settings.rs | 3 +++
2 files changed, 6 insertions(+)
diff --git a/bindings/rust/libgpiod/src/line_info.rs b/bindings/rust/libgpiod/src/line_info.rs
index 702f1b4..c4f488c 100644
--- a/bindings/rust/libgpiod/src/line_info.rs
+++ b/bindings/rust/libgpiod/src/line_info.rs
@@ -142,6 +142,9 @@ impl Info {
/// Get the debounce period of the line.
pub fn debounce_period(&self) -> Duration {
+ // c_ulong may be 32bit OR 64bit, clippy reports a false-positive here:
+ // https://github.com/rust-lang/rust-clippy/issues/10555
+ #[allow(clippy::unnecessary_cast)]
// SAFETY: `gpiod_line_info` is guaranteed to be valid here.
Duration::from_micros(unsafe {
gpiod::gpiod_line_info_get_debounce_period_us(self.info) as u64
diff --git a/bindings/rust/libgpiod/src/line_settings.rs b/bindings/rust/libgpiod/src/line_settings.rs
index 79ee2f5..f0b3e9c 100644
--- a/bindings/rust/libgpiod/src/line_settings.rs
+++ b/bindings/rust/libgpiod/src/line_settings.rs
@@ -218,6 +218,9 @@ impl Settings {
/// Get the debounce period.
pub fn debounce_period(&self) -> Result<Duration> {
+ // c_ulong may be 32bit OR 64bit, clippy reports a false-positive here:
+ // https://github.com/rust-lang/rust-clippy/issues/10555
+ #[allow(clippy::unnecessary_cast)]
// SAFETY: `gpiod_line_settings` is guaranteed to be valid here.
Ok(Duration::from_micros(unsafe {
gpiod::gpiod_line_settings_get_debounce_period_us(self.settings) as u64
--
2.41.0
next prev parent reply other threads:[~2023-06-30 11:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-30 11:18 [libgpiod][PATCH v2 0/4] bindings: rust: clippy: fix warnings Erik Schilling
2023-06-30 11:18 ` [libgpiod][PATCH v2 1/4] bindings: rust: clippy: drop unnecessary casts Erik Schilling
2023-06-30 11:18 ` Erik Schilling [this message]
2023-06-30 11:18 ` [libgpiod][PATCH v2 3/4] bindings: rust: clippy: drop unneeded conversions Erik Schilling
2023-06-30 11:18 ` [libgpiod][PATCH v2 4/4] bindings: rust: clippy: silence false-positive on iterator Erik Schilling
2023-06-30 11:54 ` [libgpiod][PATCH v2 0/4] bindings: rust: clippy: fix warnings Kent Gibson
2023-06-30 12:15 ` Bartosz Golaszewski
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=20230630-clippy-v2-2-f44447925ad6@linaro.org \
--to=erik.schilling@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=viresh.kumar@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).