mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-20 01:54:49 +00:00
28 lines
573 B
Rust
28 lines
573 B
Rust
|
// run-rustfix
|
||
|
#![warn(clippy::manual_instant_elapsed)]
|
||
|
#![allow(clippy::unnecessary_operation)]
|
||
|
#![allow(unused_variables)]
|
||
|
#![allow(unused_must_use)]
|
||
|
|
||
|
use std::time::Instant;
|
||
|
|
||
|
fn main() {
|
||
|
let prev_instant = Instant::now();
|
||
|
|
||
|
{
|
||
|
// don't influence
|
||
|
let another_instant = Instant::now();
|
||
|
}
|
||
|
|
||
|
let duration = prev_instant.elapsed();
|
||
|
|
||
|
// don't catch
|
||
|
let duration = prev_instant.elapsed();
|
||
|
|
||
|
Instant::now() - duration;
|
||
|
|
||
|
let ref_to_instant = &Instant::now();
|
||
|
|
||
|
(*ref_to_instant).elapsed(); // to ensure parens are added correctly
|
||
|
}
|