about summary refs log tree commit diff
path: root/src/libtest
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2019-10-08 01:14:42 +0100
committervarkor <github@varkor.com>2019-12-06 12:23:23 +0000
commite3a8ea4e18a50da60036d2731768a9cb78c90f5a (patch)
tree05443dd965f6dc9c520cf22a1f63c60689953146 /src/libtest
parent51901eea8c918fd55506b3e6311857d4f5bd1ba5 (diff)
downloadrust-e3a8ea4e18a50da60036d2731768a9cb78c90f5a.tar.gz
rust-e3a8ea4e18a50da60036d2731768a9cb78c90f5a.zip
Use `to_option` in various places
Diffstat (limited to 'src/libtest')
-rw-r--r--src/libtest/lib.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 7647978b3d9..9ff9e382c88 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -24,6 +24,7 @@
 #![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))]
 #![feature(rustc_private)]
 #![feature(nll)]
+#![feature(bool_to_option)]
 #![feature(set_stdio)]
 #![feature(panic_unwind)]
 #![feature(staged_api)]
@@ -562,11 +563,7 @@ fn run_test_in_process(
         None
     };
 
-    let start = if report_time {
-        Some(Instant::now())
-    } else {
-        None
-    };
+    let start = report_time.to_option(Instant::now());
     let result = catch_unwind(AssertUnwindSafe(testfn));
     let exec_time = start.map(|start| {
         let duration = start.elapsed();
@@ -597,11 +594,7 @@ fn spawn_test_subprocess(
         let args = env::args().collect::<Vec<_>>();
         let current_exe = &args[0];
 
-        let start = if report_time {
-            Some(Instant::now())
-        } else {
-            None
-        };
+        let start = report_time.to_option(Instant::now());
         let output = match Command::new(current_exe)
             .env(SECONDARY_TEST_INVOKER_VAR, desc.name.as_slice())
             .output() {