From c8f81f68e2636e1651c8fbc38bdf15438283b0cb Mon Sep 17 00:00:00 2001 From: Tino Caer Date: Wed, 22 Apr 2026 11:42:50 -0700 Subject: [PATCH] Fix connector cache test lock clippy --- codex-rs/core/src/connectors_tests.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/codex-rs/core/src/connectors_tests.rs b/codex-rs/core/src/connectors_tests.rs index f8c8506d7a..fdc32bdb0d 100644 --- a/codex-rs/core/src/connectors_tests.rs +++ b/codex-rs/core/src/connectors_tests.rs @@ -33,10 +33,10 @@ use std::path::Path; use std::sync::Arc; use std::sync::LazyLock; use tempfile::tempdir; -use tokio::sync::Mutex as TokioMutex; +use tokio::sync::Semaphore; -static ACCESSIBLE_CONNECTORS_CACHE_TEST_LOCK: LazyLock> = - LazyLock::new(|| TokioMutex::new(())); +static ACCESSIBLE_CONNECTORS_CACHE_TEST_LOCK: LazyLock = + LazyLock::new(|| Semaphore::new(1)); fn annotations(destructive_hint: Option, open_world_hint: Option) -> ToolAnnotations { ToolAnnotations { @@ -172,7 +172,10 @@ async fn with_accessible_connectors_cache_cleared(f: impl FnOnce() -> F) - where F: Future, { - let _guard = ACCESSIBLE_CONNECTORS_CACHE_TEST_LOCK.lock().await; + let _guard = ACCESSIBLE_CONNECTORS_CACHE_TEST_LOCK + .acquire() + .await + .expect("accessible connectors cache test lock should not be closed"); let previous = { let mut cache_guard = ACCESSIBLE_CONNECTORS_CACHE .lock()