From 3f85f4fc5cd058f0a2dd1fc5d2e3772d0453d4ba Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Mon, 6 May 2024 13:24:05 +0200 Subject: [PATCH] use u64::from instead of u64::try_from --- src/time.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/time.rs b/src/time.rs index 903b0040f9..8b7e6dcea4 100644 --- a/src/time.rs +++ b/src/time.rs @@ -28,7 +28,7 @@ impl timeval { u64::try_from(self.tv_sec) .ok() .and_then(|secs| secs.checked_mul(1_000_000)) - .and_then(|millions| millions.checked_add(u64::try_from(self.tv_usec).ok()?)) + .and_then(|millions| millions.checked_add(u64::from(self.tv_usec))) } } @@ -62,7 +62,7 @@ impl timespec { u64::try_from(self.tv_sec) .ok() .and_then(|secs| secs.checked_mul(1_000_000)) - .and_then(|millions| millions.checked_add(u64::try_from(self.tv_nsec).ok()? / 1000)) + .and_then(|millions| millions.checked_add(u64::from(self.tv_nsec) / 1000)) } }