summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/unchecked_duration_subtraction.rs
blob: a14a7ea57cc5052766486d7fbe62a9c363054e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// run-rustfix
#![warn(clippy::unchecked_duration_subtraction)]

use std::time::{Duration, Instant};

fn main() {
    let _first = Instant::now();
    let second = Duration::from_secs(3);

    let _ = _first - second;

    let _ = Instant::now() - Duration::from_secs(5);

    let _ = _first - Duration::from_secs(5);

    let _ = Instant::now() - second;
}