Skip to content

Commit

Permalink
Use Instant::now lazily
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Dec 6, 2019
1 parent 9f1269f commit 4425148
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libtest/lib.rs
Expand Up @@ -563,7 +563,7 @@ fn run_test_in_process(
None
};

let start = report_time.then_some(Instant::now());
let start = report_time.then(Instant::now);
let result = catch_unwind(AssertUnwindSafe(testfn));
let exec_time = start.map(|start| {
let duration = start.elapsed();
Expand Down Expand Up @@ -594,7 +594,7 @@ fn spawn_test_subprocess(
let args = env::args().collect::<Vec<_>>();
let current_exe = &args[0];

let start = report_time.then_some(Instant::now());
let start = report_time.then(Instant::now);
let output = match Command::new(current_exe)
.env(SECONDARY_TEST_INVOKER_VAR, desc.name.as_slice())
.output() {
Expand Down

0 comments on commit 4425148

Please sign in to comment.