diff --git a/src/lib.rs b/src/lib.rs index b39c965..55e695c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -120,16 +120,17 @@ //! This allows for async usage in an async context, or blocking usage in a //! non-async context. //! -//! Operations such as [`DeviceInfo::open`], [`Device::set_configuration`], -//! [`Device::reset`], [`Device::claim_interface`], -//! [`Interface::set_alt_setting`], and [`Endpoint::clear_halt`] require -//! blocking system calls. To use these in an asynchronous context, `nusb` -//! relies on an async runtime to run these operations on an IO thread to avoid -//! blocking in async code. Enable the cargo feature `tokio` or `smol` to use -//! the corresponding runtime for blocking IO. If neither feature is enabled, -//! `.await` on these methods will log a warning and block the calling thread. -//! `.wait()` always runs the blocking operation directly without the overhead -//! of handing off to an IO thread. +//! Operations such as [`list_devices`], [`list_buses`], [`DeviceInfo::open`], +//! [`Device::set_configuration`], [`Device::reset`], +//! [`Device::claim_interface`], [`Interface::set_alt_setting`], and +//! [`Endpoint::clear_halt`] require blocking system calls. To use these in an +//! asynchronous context, `nusb` requires an async runtime to run these +//! operations on an IO thread to avoid blocking in async code. Enable the cargo +//! feature `tokio` or `smol` to use the corresponding runtime for blocking IO. +//! If neither feature is enabled, `.await` on these methods will panic. +//! +//! For blocking usage, `.wait()` always runs the blocking operation directly +//! without the overhead of handing off to an IO thread. //! //! These features do not affect and are not required for transfers, which are //! implemented on top of natively-async OS APIs. diff --git a/src/maybe_future.rs b/src/maybe_future.rs index f0d8721..cb56d19 100644 --- a/src/maybe_future.rs +++ b/src/maybe_future.rs @@ -107,13 +107,7 @@ pub mod blocking { #[cfg(not(any(feature = "smol", feature = "tokio")))] fn spawn(f: impl FnOnce() -> R + Send + 'static) -> Self { - static ONCE: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(true); - - if ONCE.swap(false, std::sync::atomic::Ordering::Relaxed) { - log::warn!("Awaiting blocking syscall without an async runtime: enable the `smol` or `tokio` feature of `nusb` to avoid blocking the thread.") - } - - Self(Some(f())) + panic!("Awaiting blocking syscall without an async runtime: enable the `smol` or `tokio` feature of nusb."); } }