Skip to content

Commit

Permalink
Add possible fallable conversion to libc::suseconds_t (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
ravenclaw900 authored Jun 23, 2024
1 parent d0656e4 commit fec7d73
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/posix_not_mac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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().into(),
tv_usec: timeout
.subsec_micros()
.try_into()
.expect("timeout overflow"),

Check warning on line 78 in src/posix_not_mac.rs

View workflow job for this annotation

GitHub Actions / clippy

use of a fallible conversion when an infallible one could be used

warning: use of a fallible conversion when an infallible one could be used --> src/posix_not_mac.rs:77:22 | 77 | .try_into() | ______________________^ 78 | | .expect("timeout overflow"), | |_______________________________________________^ | = note: converting `u32` to `i64` cannot fail = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions = note: `#[warn(clippy::unnecessary_fallible_conversions)]` on by default help: use | 77 - .try_into() 77 + .into(), |
};
// a timeout of 0 is infinity, so if the requested duration is too
// small, make it nonzero
Expand Down

0 comments on commit fec7d73

Please sign in to comment.