diff --git a/src/sync.rs b/src/sync.rs index b63326f33a9..78e38d26758 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -126,10 +126,9 @@ impl GILOnceCell { return value; } - match self.init(py, || Ok::(f())) { - Ok(value) => value, - Err(void) => match void {}, - } + // .unwrap() will never panic because the result is always Ok + self.init(py, || Ok::(f())) + .unwrap() } /// Like `get_or_init`, but accepts a fallible initialization function. If it fails, the cell