nushell/crates/nu-explore
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
..
src Replace subtraction of Instants and Durations with saturating subtractions (#12549) 2024-04-17 07:25:16 -05:00
.gitignore [MVP][WIP] less like pager (#6984) 2022-12-01 09:32:10 -06:00
Cargo.toml Bump version to 0.92.3 (#12476) 2024-04-12 08:00:43 -05:00
LICENSE Fix rest of license year ranges (#8727) 2023-04-04 09:03:29 +12:00