Simplify with unwrap_or_else().
This commit is contained in:
@@ -127,9 +127,7 @@ fn worker_thread(thread_num: usize,
|
|||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let result = match catch_unwind(|| runone::run(path.as_path())) {
|
let result = catch_unwind(|| runone::run(path.as_path())).unwrap_or_else(|e| {
|
||||||
Ok(r) => r,
|
|
||||||
Err(e) => {
|
|
||||||
// The test panicked, leaving us a `Box<Any>`.
|
// The test panicked, leaving us a `Box<Any>`.
|
||||||
// Panics are usually strings.
|
// Panics are usually strings.
|
||||||
if let Some(msg) = e.downcast_ref::<String>() {
|
if let Some(msg) = e.downcast_ref::<String>() {
|
||||||
@@ -139,8 +137,7 @@ fn worker_thread(thread_num: usize,
|
|||||||
} else {
|
} else {
|
||||||
Err(format!("panicked in worker #{}", thread_num))
|
Err(format!("panicked in worker #{}", thread_num))
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
};
|
|
||||||
|
|
||||||
replies.send(Reply::Done {
|
replies.send(Reply::Done {
|
||||||
jobid: jobid,
|
jobid: jobid,
|
||||||
|
|||||||
Reference in New Issue
Block a user