Skip to content

Commit 8c2c83c

Browse files
Try to fix unit tests
1 parent 9b0cebb commit 8c2c83c

File tree

1 file changed

+7
-10
lines changed
  • sqlx-core/src/net/socket

1 file changed

+7
-10
lines changed

sqlx-core/src/net/socket/mod.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,18 +234,15 @@ pub async fn connect_tcp<Ws: WithSocket>(
234234
}
235235

236236
async fn connect_tcp_address(socket_addr: SocketAddr) -> crate::Result<impl Socket> {
237-
#[cfg(feature = "_rt-tokio")]
238-
if crate::rt::rt_tokio::available() {
239-
use tokio::net::TcpStream;
240-
241-
let stream = TcpStream::connect(socket_addr).await?;
242-
stream.set_nodelay(true)?;
237+
cfg_if! {
238+
if #[cfg(feature = "_rt-tokio")] {
239+
use tokio::net::TcpStream;
243240

244-
return Ok(stream);
245-
}
241+
let stream = TcpStream::connect(socket_addr).await?;
242+
stream.set_nodelay(true)?;
246243

247-
cfg_if! {
248-
if #[cfg(feature = "_rt-async-io")] {
244+
Ok(stream)
245+
} else if #[cfg(feature = "_rt-async-io")] {
249246
use async_io::Async;
250247
use std::net::TcpStream;
251248

0 commit comments

Comments
 (0)