Skip to content

clippy lint in Instant::duration_since#123

Merged
cfallin merged 1 commit intomainfrom
pch/latest_rust_lint
Mar 10, 2026
Merged

clippy lint in Instant::duration_since#123
cfallin merged 1 commit intomainfrom
pch/latest_rust_lint

Conversation

@pchickey
Copy link
Contributor

@pchickey pchickey commented Mar 10, 2026

Fixes a new CI error in Rust 1.94:

error: manual saturating arithmetic
  --> src/time/instant.rs:33:30
   |
33 |         Duration::from_nanos(self.0.checked_sub(earlier.0).unwrap_or_default())
   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `self.0.saturating_sub(earlier.0)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.94.0/index.html#manual_saturating_arithmetic
   = note: `-D clippy::manual-saturating-arithmetic` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::manual_saturating_arithmetic)]`

Fixes a new CI error in Rust 1.94:

error: manual saturating arithmetic
  --> src/time/instant.rs:33:30
   |
33 |         Duration::from_nanos(self.0.checked_sub(earlier.0).unwrap_or_default())
   |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `self.0.saturating_sub(earlier.0)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.94.0/index.html#manual_saturating_arithmetic
   = note: `-D clippy::manual-saturating-arithmetic` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::manual_saturating_arithmetic)]`
@pchickey pchickey requested a review from cfallin March 10, 2026 21:55
@cfallin cfallin merged commit dea316a into main Mar 10, 2026
5 checks passed
@pchickey pchickey deleted the pch/latest_rust_lint branch March 10, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants