Open
Description
Summary
Duration
values cannot be negative under any circumstance, so it's not useful to check if a Duration
is less than zero. Please make sure all Duration
s which can be const evaluated to zero, are treated as zero for the purposes of this lint.
Lint Name
absurd_extreme_comparisons
Reproducer
I tried this code:
if duration < Duration::from_secs(0) {
// ...
}
I expected to see this happen: absurd_extreme_comparisons lint activates
Instead, this happened: no lint is triggered, code is accepted as is
Version
rustc 1.85.0 (4d91de4e4 2025-02-17)
binary: rustc
commit-hash: 4d91de4e48198da2e33413efdcd9cd2cc0c46688
commit-date: 2025-02-17
host: aarch64-unknown-linux-gnu
release: 1.85.0
LLVM version: 19.1.7