Closed
Description
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:
Old | New |
---|---|
dur.subsec_nanos() / 1_000_000 |
dur.subsec_millis() |
dur.subsec_nanos() / 1_000 |
dur.subsec_micros() |
This mainly helps modernizing existing code.