| #![warn(clippy::unchecked_duration_subtraction)] |
| |
| use std::time::{Duration, Instant}; |
| |
| fn main() { |
| let _first = Instant::now(); |
| let second = Duration::from_secs(3); |
| |
| let _ = _first.checked_sub(second).unwrap(); |
| //~^ unchecked_duration_subtraction |
| |
| let _ = Instant::now().checked_sub(Duration::from_secs(5)).unwrap(); |
| //~^ unchecked_duration_subtraction |
| |
| let _ = _first.checked_sub(Duration::from_secs(5)).unwrap(); |
| //~^ unchecked_duration_subtraction |
| |
| let _ = Instant::now().checked_sub(second).unwrap(); |
| //~^ unchecked_duration_subtraction |
| } |