From 4323e3013380933e8e40a9b0617060de52baafda Mon Sep 17 00:00:00 2001 From: Greg Johnston Date: Fri, 21 Jun 2024 11:17:54 -0400 Subject: [PATCH] fix tests --- any_spawner/src/lib.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/any_spawner/src/lib.rs b/any_spawner/src/lib.rs index 37b19bc22..455d28c76 100644 --- a/any_spawner/src/lib.rs +++ b/any_spawner/src/lib.rs @@ -14,14 +14,15 @@ //! ```rust //! use any_spawner::Executor; //! -//! Executor::init_futures_executor() -//! .expect("executor should only be initialized once"); +//! // make sure an Executor has been initialized with one of the init_ functions //! +//! # if false { //! // spawn a thread-safe Future //! Executor::spawn(async { /* ... */ }); //! //! // spawn a Future that is !Send //! Executor::spawn_local(async { /* ... */ }); +//! # } //! ``` #![forbid(unsafe_code)] @@ -51,12 +52,10 @@ impl Executor { /// Spawns a thread-safe [`Future`]. /// ```rust /// use any_spawner::Executor; - /// - /// Executor::init_futures_executor() - /// .expect("executor should only be initialized once"); - /// + /// # if false { /// // spawn a thread-safe Future /// Executor::spawn(async { /* ... */ }); + /// # } /// ``` #[track_caller] pub fn spawn(fut: impl Future + Send + 'static) { @@ -82,11 +81,10 @@ impl Executor { /// ```rust /// use any_spawner::Executor; /// - /// Executor::init_futures_executor() - /// .expect("executor should only be initialized once"); - /// + /// # if false { /// // spawn a thread-safe Future - /// Executor::spawn(async { /* ... */ }); + /// Executor::spawn_local(async { /* ... */ }); + /// # } /// ``` #[track_caller] pub fn spawn_local(fut: impl Future + 'static) {