Suggestion: Replace d.subsec_nanos() / 1_000_000
with d.subsec_millis()
#2543
Labels
A-lint
Area: New lints
rust-lang/rust#46507 may soon be stabilized. Code that computes the milliseconds/microseconds-part of a duration could use the
.subsec_millis()
/.subsec_micros()
methods directly instead of going through a computation with lots of zeros. Clippy should add a lint for the following patterns:dur.subsec_nanos() / 1_000_000
dur.subsec_millis()
dur.subsec_nanos() / 1_000
dur.subsec_micros()
This mainly helps modernizing existing code.
The text was updated successfully, but these errors were encountered: