From 5d7a503a3bd0ed5462452e2fdcd9862744a77d8c Mon Sep 17 00:00:00 2001 From: bokuweb Date: Fri, 24 Mar 2023 14:43:46 +0900 Subject: [PATCH] chore: use Duration::MAX instead of duration_max --- .github/workflows/ci.yml | 2 +- Cargo.toml | 2 +- src/lib.rs | 9 ++------- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65bd24a..82164d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -112,7 +112,7 @@ jobs: os: [ubuntu-latest, windows-latest] # When updating this, the reminder to update the minimum supported # Rust version in Cargo.toml. - rust: ['1.48'] + rust: ['1.53'] steps: - uses: actions/checkout@v3 - name: Install Rust diff --git a/Cargo.toml b/Cargo.toml index 315447e..8e938fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ name = "async-io" version = "1.13.0" authors = ["Stjepan Glavina "] edition = "2018" -rust-version = "1.48" +rust-version = "1.53" description = "Async I/O and timers" license = "Apache-2.0 OR MIT" repository = "https://github.com/smol-rs/async-io" diff --git a/src/lib.rs b/src/lib.rs index 54cd8aa..2dd9389 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -91,11 +91,6 @@ mod reactor; 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. @@ -193,7 +188,7 @@ impl Timer { Timer { id_and_waker: None, when: None, - period: duration_max(), + period: Duration::MAX, } } @@ -231,7 +226,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.