Skip to content

Commit

Permalink
refactor: remove redundant async signature
Browse files Browse the repository at this point in the history
Resolves libp2p#4832

Pull-Request: libp2p#5468.
  • Loading branch information
dariusc93 committed Jun 18, 2024
1 parent a8a4957 commit 0b1733d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 3 additions & 0 deletions libp2p/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
3 changes: 1 addition & 2 deletions libp2p/src/builder/phase/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ pub struct DnsPhase<T> {

#[cfg(all(not(target_arch = "wasm32"), feature = "async-std", feature = "dns"))]
impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::AsyncStd, DnsPhase<T>> {
// TODO: Remove `async`
pub async fn with_dns(
pub fn with_dns(
self,
) -> Result<
SwarmBuilder<
Expand Down
4 changes: 2 additions & 2 deletions libp2p/src/builder/phase/other_transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl<Provider, T: AuthenticatedMultiplexedTransport>
impl<T: AuthenticatedMultiplexedTransport>
SwarmBuilder<super::provider::AsyncStd, OtherTransportPhase<T>>
{
pub async fn with_dns(
pub fn with_dns(
self,
) -> Result<
SwarmBuilder<
Expand All @@ -82,7 +82,7 @@ impl<T: AuthenticatedMultiplexedTransport>
>,
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"))]
Expand Down
3 changes: 1 addition & 2 deletions libp2p/src/builder/phase/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl<Provider, T: AuthenticatedMultiplexedTransport> SwarmBuilder<Provider, Quic
}
#[cfg(all(not(target_arch = "wasm32"), feature = "async-std", feature = "dns"))]
impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::AsyncStd, QuicPhase<T>> {
pub async fn with_dns(
pub fn with_dns(
self,
) -> Result<
SwarmBuilder<
Expand All @@ -162,7 +162,6 @@ impl<T: AuthenticatedMultiplexedTransport> SwarmBuilder<super::provider::AsyncSt
self.without_quic()
.without_any_other_transports()
.with_dns()
.await
}
}
#[cfg(all(not(target_arch = "wasm32"), feature = "tokio", feature = "dns"))]
Expand Down

0 comments on commit 0b1733d

Please sign in to comment.