aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Schilling <erik.schilling@linaro.org>2023-06-30 13:18:45 +0200
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-06-30 14:10:24 +0200
commit46115fddd7cbf96aa803c0622c69e22974cead44 (patch)
treea94facfc85253613d30251e77e10a795c216945f
parent901104ec2fa5f4c60f157ccb236a9b967fa7fa6b (diff)
downloadlibgpiod-46115fddd7cbf96aa803c0622c69e22974cead44.tar.gz
bindings: rust: clippy: silence false-positives on casts
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> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Kent Gibson <warthog618@gmail.com> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-rw-r--r--bindings/rust/libgpiod/src/line_info.rs3
-rw-r--r--bindings/rust/libgpiod/src/line_settings.rs3
2 files changed, 6 insertions, 0 deletions
diff --git a/bindings/rust/libgpiod/src/line_info.rs b/bindings/rust/libgpiod/src/line_info.rs
index 702f1b47..c4f488cb 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 79ee2f59..f0b3e9c6 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