Skip to content

Commit d1e91f6

Browse files
Fix of test_block_on, regression
1 parent 653152a commit d1e91f6

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

sqlx-core/src/rt/mod.rs

+6-11
Original file line numberDiff line numberDiff line change
@@ -138,22 +138,17 @@ pub async fn yield_now() {
138138

139139
#[track_caller]
140140
pub fn test_block_on<F: Future>(f: F) -> F::Output {
141-
#[cfg(feature = "_rt-tokio")]
142-
{
143-
if rt_tokio::available() {
144-
return tokio::runtime::Builder::new_current_thread()
145-
.enable_all()
146-
.build()
147-
.expect("failed to start Tokio runtime")
148-
.block_on(f);
149-
}
150-
}
151-
152141
cfg_if! {
153142
if #[cfg(feature = "_rt-async-std")] {
154143
async_std::task::block_on(f)
155144
} else if #[cfg(feature = "_rt-smol")] {
156145
smol::block_on(f)
146+
} else if #[cfg(feature = "_rt-tokio")] {
147+
tokio::runtime::Builder::new_current_thread()
148+
.enable_all()
149+
.build()
150+
.expect("failed to start Tokio runtime")
151+
.block_on(f)
157152
} else {
158153
missing_rt(f)
159154
}

0 commit comments

Comments
 (0)