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