From 15320bdb590d8c61d9bb963fbd7b89b12f2bf8aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Laitl?= Date: Tue, 13 Feb 2024 12:07:11 +0100 Subject: [PATCH 1/2] Fix clippy 1.75 warnings --- device/src/u3v/async_read.rs | 2 +- gentl/src/ffi/port.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/device/src/u3v/async_read.rs b/device/src/u3v/async_read.rs index 921dbd02..91852028 100644 --- a/device/src/u3v/async_read.rs +++ b/device/src/u3v/async_read.rs @@ -233,7 +233,7 @@ fn poll_completed( let remaining = deadline.saturating_duration_since(Instant::now()); let timeval = libc::timeval { tv_sec: remaining.as_secs().try_into().unwrap(), - tv_usec: remaining.subsec_micros().try_into().unwrap(), + tv_usec: remaining.subsec_micros().into(), }; if libusb_try_lock_events(ctx.as_raw()) == 0_i32 { diff --git a/gentl/src/ffi/port.rs b/gentl/src/ffi/port.rs index 99197f4a..3164242c 100644 --- a/gentl/src/ffi/port.rs +++ b/gentl/src/ffi/port.rs @@ -232,7 +232,7 @@ gentl_api! { let handle = unsafe { ModuleHandle::from_raw_manually_drop(hPort)? }; let url = with_port!(handle, |port| { // Use first info. - let xml_info = port.xml_infos()?.get(0).ok_or_else(|| GenTlError::Error("no xml information in the device".into()))?; + let xml_info = port.xml_infos()?.first().ok_or_else(|| GenTlError::Error("no xml information in the device".into()))?; file_location_to_url(xml_info, port.port_info()?) }); From 73b75baf31eed2356c741c3f45f803d25c900727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Laitl?= Date: Tue, 13 Feb 2024 12:18:16 +0100 Subject: [PATCH 2/2] Fix MacOS build (revert and whitelist one clippy suggestion) --- device/src/u3v/async_read.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/device/src/u3v/async_read.rs b/device/src/u3v/async_read.rs index 91852028..383388ed 100644 --- a/device/src/u3v/async_read.rs +++ b/device/src/u3v/async_read.rs @@ -233,7 +233,9 @@ fn poll_completed( let remaining = deadline.saturating_duration_since(Instant::now()); let timeval = libc::timeval { tv_sec: remaining.as_secs().try_into().unwrap(), - tv_usec: remaining.subsec_micros().into(), + // tv_usec is i64 on Linux (with infallible conversion from u32), but i32 on Mac. + #[allow(clippy::unnecessary_fallible_conversions)] + tv_usec: remaining.subsec_micros().try_into().unwrap(), }; if libusb_try_lock_events(ctx.as_raw()) == 0_i32 {