From 5da8aff98ea6bb257aa19ee8fb54711787a28fc0 Mon Sep 17 00:00:00 2001 From: drHuangMHT Date: Fri, 27 Dec 2024 11:00:40 +0800 Subject: [PATCH 1/2] remove deprecated builder functions --- libp2p/src/builder/phase/bandwidth_logging.rs | 22 ------------------ libp2p/src/builder/phase/other_transport.rs | 23 +------------------ libp2p/src/builder/phase/quic.rs | 21 ----------------- 3 files changed, 1 insertion(+), 65 deletions(-) diff --git a/libp2p/src/builder/phase/bandwidth_logging.rs b/libp2p/src/builder/phase/bandwidth_logging.rs index f24df5f3df5..13fe20caecb 100644 --- a/libp2p/src/builder/phase/bandwidth_logging.rs +++ b/libp2p/src/builder/phase/bandwidth_logging.rs @@ -13,28 +13,6 @@ pub struct BandwidthLoggingPhase { impl SwarmBuilder> { - #[allow(deprecated)] - #[deprecated(note = "Use `with_bandwidth_metrics` instead.")] - pub fn with_bandwidth_logging( - self, - ) -> ( - SwarmBuilder>, - Arc, - ) { - let (transport, sinks) = self.phase.transport.with_bandwidth_logging(); - ( - SwarmBuilder { - phase: BandwidthMetricsPhase { - relay_behaviour: self.phase.relay_behaviour, - transport, - }, - keypair: self.keypair, - phantom: PhantomData, - }, - sinks, - ) - } - pub fn without_bandwidth_logging(self) -> SwarmBuilder> { SwarmBuilder { phase: BandwidthMetricsPhase { diff --git a/libp2p/src/builder/phase/other_transport.rs b/libp2p/src/builder/phase/other_transport.rs index c3b951c8c75..586538c5840 100644 --- a/libp2p/src/builder/phase/other_transport.rs +++ b/libp2p/src/builder/phase/other_transport.rs @@ -173,28 +173,7 @@ impl .with_relay_client(security_upgrade, multiplexer_upgrade) } } -impl - SwarmBuilder> -{ - #[allow(deprecated)] - #[deprecated(note = "Use `with_bandwidth_metrics` instead.")] - pub fn with_bandwidth_logging( - self, - ) -> ( - SwarmBuilder< - Provider, - BandwidthMetricsPhase, - >, - Arc, - ) { - #[allow(deprecated)] - self.without_any_other_transports() - .without_dns() - .without_websocket() - .without_relay() - .with_bandwidth_logging() - } -} + #[cfg(feature = "metrics")] impl SwarmBuilder> diff --git a/libp2p/src/builder/phase/quic.rs b/libp2p/src/builder/phase/quic.rs index 1b6329c1095..d1cf5aeb2ad 100644 --- a/libp2p/src/builder/phase/quic.rs +++ b/libp2p/src/builder/phase/quic.rs @@ -276,27 +276,6 @@ impl_quic_phase_with_websocket!( super::provider::Tokio, rw_stream_sink::RwStreamSink> ); -impl SwarmBuilder> { - #[allow(deprecated)] - #[deprecated(note = "Use `with_bandwidth_metrics` instead.")] - pub fn with_bandwidth_logging( - self, - ) -> ( - SwarmBuilder< - Provider, - BandwidthMetricsPhase, - >, - Arc, - ) { - #[allow(deprecated)] - self.without_quic() - .without_any_other_transports() - .without_dns() - .without_websocket() - .without_relay() - .with_bandwidth_logging() - } -} #[cfg(feature = "metrics")] impl SwarmBuilder> { pub fn with_bandwidth_metrics( From 3e0f2889bd44b2170255f0ecc6ee1921752a83a5 Mon Sep 17 00:00:00 2001 From: drHuangMHT Date: Fri, 27 Dec 2024 11:08:05 +0800 Subject: [PATCH 2/2] reduce diff --- libp2p/src/builder/phase/other_transport.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/libp2p/src/builder/phase/other_transport.rs b/libp2p/src/builder/phase/other_transport.rs index 586538c5840..9c7ddd994e4 100644 --- a/libp2p/src/builder/phase/other_transport.rs +++ b/libp2p/src/builder/phase/other_transport.rs @@ -173,7 +173,6 @@ impl .with_relay_client(security_upgrade, multiplexer_upgrade) } } - #[cfg(feature = "metrics")] impl SwarmBuilder>