]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/manual_instant_elapsed.rs
1 #![warn(clippy::manual_instant_elapsed)]
2 #![allow(clippy::unnecessary_operation)]
3 #![allow(clippy::unchecked_duration_subtraction)]
4 #![allow(unused_variables)]
5 #![allow(unused_must_use)]
7 use std
::time
::Instant
;
10 let prev_instant
= Instant
::now();
14 let another_instant
= Instant
::now();
17 let duration
= Instant
::now() - prev_instant
;
20 let duration
= prev_instant
.elapsed();
22 Instant
::now() - duration
;
24 let ref_to_instant
= &Instant
::now();
26 Instant
::now() - *ref_to_instant
; // to ensure parens are added correctly