From 425f38e04767101a8e46e2b439d9ba81e6ef3f46 Mon Sep 17 00:00:00 2001 From: shray sharma Date: Sun, 13 Oct 2024 20:12:53 +0200 Subject: [PATCH] improved comments and error handling --- rayon-core/src/job.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/rayon-core/src/job.rs b/rayon-core/src/job.rs index 5664bb385..bc6fe99f9 100644 --- a/rayon-core/src/job.rs +++ b/rayon-core/src/job.rs @@ -221,19 +221,20 @@ impl JobResult { } } - /// Convert the `JobResult` for a job that has finished (and hence - /// its JobResult is populated) into its return value. + /// Converts the `JobResult` for a finished job into its return value. /// - /// NB. This will panic if the job panicked. + /// # Panics + /// This will panic if the job resulted in a panic (`JobResult::Panic`). pub(super) fn into_return_value(self) -> T { match self { - JobResult::None => unreachable!(), + JobResult::None => unreachable!("JobResult should not be None after completion."), JobResult::Ok(x) => x, JobResult::Panic(x) => unwind::resume_unwinding(x), } } } + /// Indirect queue to provide FIFO job priority. pub(super) struct JobFifo { inner: Injector,