From d27b1adc21a9a0c3bde3cb35b0a9aa05d5c1e91c Mon Sep 17 00:00:00 2001 From: John Nunley Date: Sun, 11 Jun 2023 08:26:31 -0700 Subject: [PATCH] Use Duration::MAX --- src/lib.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fd4ab9c..44ec6e4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -93,11 +93,6 @@ pub mod os; pub use driver::block_on; pub use reactor::{Readable, ReadableOwned, Writable, WritableOwned}; -/// Use `Duration::MAX` once `duration_constants` are stabilized. -fn duration_max() -> Duration { - Duration::new(std::u64::MAX, 1_000_000_000 - 1) -} - /// A future or stream that emits timed events. /// /// Timers are futures that output a single [`Instant`] when they fire. @@ -195,7 +190,7 @@ impl Timer { Timer { id_and_waker: None, when: None, - period: duration_max(), + period: Duration::MAX, } } @@ -232,8 +227,7 @@ impl Timer { /// # }); /// ``` pub fn at(instant: Instant) -> Timer { - // Use Duration::MAX once duration_constants are stabilized. - Timer::interval_at(instant, duration_max()) + Timer::interval_at(instant, Duration::MAX) } /// Creates a timer that emits events periodically.