1
0
mirror of https://github.com/nushell/nushell.git synced 2025-04-26 14:18:19 +02:00
nushell/crates/nu-system
Devyn Cairns 13160b3ec3
Replace subtraction of Instants and Durations with saturating subtractions ()
# Description
Duration can not be negative, and an underflow causes a panic.

This should fix  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
..
examples Reduce again the number of match calls () 2023-01-24 12:23:42 +01:00
src Replace subtraction of Instants and Durations with saturating subtractions () 2024-04-17 07:25:16 -05:00
.gitignore Add nu-system and rewrite ps command () 2022-01-14 17:20:53 +11:00
Cargo.toml Bump version to 0.92.3 () 2024-04-12 08:00:43 -05:00
LICENSE Nu glob () 2022-03-13 11:30:27 -07:00