nushell/crates/nu-explore/src/pager
Devyn Cairns 13160b3ec3
Replace subtraction of Instants and Durations with saturating subtractions (#12549)
# Description
Duration can not be negative, and an underflow causes a panic.

This should fix #12539 as from what I can tell that bug was caused in
`nu-explore:📟:events` from subtracting durations, but I figured
this might be more widespread, and saturating to zero generally makes
sense.

I also added the relevant clippy lint to try to prevent this from
happening in the future. I can't think of a reason we would ever want to
subtract durations without checking first.

cc @fdncred

# Tests + Formatting
- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`
2024-04-17 07:25:16 -05:00
..
command_bar.rs using ratatui instead of tui (#8952) 2023-04-26 01:07:23 +02:00
events.rs Replace subtraction of Instants and Durations with saturating subtractions (#12549) 2024-04-17 07:25:16 -05:00
mod.rs Copy-on-write for record values (#12305) 2024-04-14 01:42:03 +00:00
report.rs nu-explore: Refactorings (#10247) 2023-09-06 13:24:24 -05:00
status_bar.rs nu-explore: Refactorings (#10247) 2023-09-06 13:24:24 -05:00