From 16f6378d202e295062ab583b7be4bd4b0222bc45 Mon Sep 17 00:00:00 2001 From: ravenclaw900 <50060110+ravenclaw900@users.noreply.github.com> Date: Sat, 22 Jun 2024 22:09:19 +0000 Subject: [PATCH 1/2] Add possible fallable conversion to `libc::suseconds_t` --- src/posix_not_mac.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/posix_not_mac.rs b/src/posix_not_mac.rs index 21c9c26..dedbba1 100644 --- a/src/posix_not_mac.rs +++ b/src/posix_not_mac.rs @@ -72,7 +72,7 @@ impl PosixIfChangeNotifier { let timeout = if let Some(timeout) = timeout { let mut t = timeval { tv_sec: timeout.as_secs().try_into().expect("timeout overflow"), - tv_usec: timeout.subsec_micros().into(), + tv_usec: timeout.subsec_micros().try_into().expect("timeout overflow"), }; // a timeout of 0 is infinity, so if the requested duration is too // small, make it nonzero From ce6dc5ba12401e4a9537d3ccd98207c7f5302702 Mon Sep 17 00:00:00 2001 From: ravenclaw900 <50060110+ravenclaw900@users.noreply.github.com> Date: Sat, 22 Jun 2024 22:12:37 +0000 Subject: [PATCH 2/2] Fix formatting --- src/posix_not_mac.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/posix_not_mac.rs b/src/posix_not_mac.rs index dedbba1..10ce0ec 100644 --- a/src/posix_not_mac.rs +++ b/src/posix_not_mac.rs @@ -72,7 +72,10 @@ impl PosixIfChangeNotifier { let timeout = if let Some(timeout) = timeout { let mut t = timeval { tv_sec: timeout.as_secs().try_into().expect("timeout overflow"), - tv_usec: timeout.subsec_micros().try_into().expect("timeout overflow"), + tv_usec: timeout + .subsec_micros() + .try_into() + .expect("timeout overflow"), }; // a timeout of 0 is infinity, so if the requested duration is too // small, make it nonzero