From 8421034726d65ce58f8e6587f7b9a0fb6c113f62 Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Thu, 31 Oct 2024 09:04:19 -0600 Subject: [PATCH] fix clippy --- src/err/err_state.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/err/err_state.rs b/src/err/err_state.rs index f8ef457d95c..5d930794014 100644 --- a/src/err/err_state.rs +++ b/src/err/err_state.rs @@ -83,9 +83,10 @@ impl PyErrState { // Guard against re-entrant normalization, because `Once` does not provide // re-entrancy guarantees. if let Some(thread) = self.normalizing_thread.lock().unwrap().as_ref() { - if *thread == std::thread::current().id() { - panic!("Re-entrant normalization of PyErrState detected"); - } + assert!( + !(*thread == std::thread::current().id()), + "Re-entrant normalization of PyErrState detected" + ); } self.normalized.call_once(|| { @@ -113,7 +114,7 @@ impl PyErrState { // Safety: self.inner will never be written again once normalized. &*self.inner.get() } { - Some(PyErrStateInner::Normalized(n)) => return n, + Some(PyErrStateInner::Normalized(n)) => n, _ => unreachable!(), } }