From 146c39705d9a37d5a42c5bc0525ce81fb3599d7f Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Tue, 13 Aug 2024 00:34:01 +0100 Subject: [PATCH] ci: fix nightly warning about unreachable pattern (#4437) * ci: fix nightly warning about unreachable pattern * add comment --- src/sync.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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