From 0b1733d4db065e0236a28f8628d9b401b9645001 Mon Sep 17 00:00:00 2001 From: Darius Clark Date: Tue, 18 Jun 2024 09:43:24 -0400 Subject: [PATCH] refactor: remove redundant async signature Resolves #4832 Pull-Request: #5468. --- libp2p/CHANGELOG.md | 3 +++ libp2p/src/builder/phase/dns.rs | 3 +-- libp2p/src/builder/phase/other_transport.rs | 4 ++-- libp2p/src/builder/phase/quic.rs | 3 +-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/libp2p/CHANGELOG.md b/libp2p/CHANGELOG.md index ed3ecbe2f20..23efbc21fd9 100644 --- a/libp2p/CHANGELOG.md +++ b/libp2p/CHANGELOG.md @@ -9,6 +9,9 @@ - Use `web-time` instead of `instant`. See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347). +- Remove redundant async signature from builder methods. + See [PR 5468](https://github.com/libp2p/rust-libp2p/pull/5468). + ## 0.53.2 - Allow `SwarmBuilder::with_bandwidth_metrics` after `SwarmBuilder::with_websocket`. diff --git a/libp2p/src/builder/phase/dns.rs b/libp2p/src/builder/phase/dns.rs index 135f6c57b19..638064d58bb 100644 --- a/libp2p/src/builder/phase/dns.rs +++ b/libp2p/src/builder/phase/dns.rs @@ -8,8 +8,7 @@ pub struct DnsPhase { #[cfg(all(not(target_arch = "wasm32"), feature = "async-std", feature = "dns"))] impl SwarmBuilder> { - // TODO: Remove `async` - pub async fn with_dns( + pub fn with_dns( self, ) -> Result< SwarmBuilder< diff --git a/libp2p/src/builder/phase/other_transport.rs b/libp2p/src/builder/phase/other_transport.rs index b0d56cd92d2..e04621b2e3f 100644 --- a/libp2p/src/builder/phase/other_transport.rs +++ b/libp2p/src/builder/phase/other_transport.rs @@ -73,7 +73,7 @@ impl impl SwarmBuilder> { - pub async fn with_dns( + pub fn with_dns( self, ) -> Result< SwarmBuilder< @@ -82,7 +82,7 @@ impl >, std::io::Error, > { - self.without_any_other_transports().with_dns().await + self.without_any_other_transports().with_dns() } } #[cfg(all(not(target_arch = "wasm32"), feature = "tokio", feature = "dns"))] diff --git a/libp2p/src/builder/phase/quic.rs b/libp2p/src/builder/phase/quic.rs index 885b16e2e03..e030e9493bb 100644 --- a/libp2p/src/builder/phase/quic.rs +++ b/libp2p/src/builder/phase/quic.rs @@ -150,7 +150,7 @@ impl SwarmBuilder SwarmBuilder> { - pub async fn with_dns( + pub fn with_dns( self, ) -> Result< SwarmBuilder< @@ -162,7 +162,6 @@ impl SwarmBuilder