2023-04-20 09:37:15 -05:00
|
|
|
//@run-rustfix
|
2022-11-08 03:22:58 -06:00
|
|
|
#![warn(clippy::unchecked_duration_subtraction)]
|
|
|
|
|
|
|
|
use std::time::{Duration, Instant};
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let _first = Instant::now();
|
|
|
|
let second = Duration::from_secs(3);
|
|
|
|
|
2022-11-08 08:04:32 -06:00
|
|
|
let _ = _first.checked_sub(second).unwrap();
|
2022-11-08 03:22:58 -06:00
|
|
|
|
2022-11-08 08:04:32 -06:00
|
|
|
let _ = Instant::now().checked_sub(Duration::from_secs(5)).unwrap();
|
2022-11-08 03:22:58 -06:00
|
|
|
|
2022-11-08 08:04:32 -06:00
|
|
|
let _ = _first.checked_sub(Duration::from_secs(5)).unwrap();
|
2022-11-08 03:22:58 -06:00
|
|
|
|
2022-11-08 08:04:32 -06:00
|
|
|
let _ = Instant::now().checked_sub(second).unwrap();
|
2022-11-08 03:22:58 -06:00
|
|
|
}
|