Skip to content

Commit

Permalink
Remove use for map
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden committed Sep 3, 2023
1 parent e497cb2 commit a80d726
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 3 additions & 4 deletions libp2p/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::sync::Arc;

use crate::bandwidth::BandwidthSinks;
use crate::TransportExt;
use map::Map as MapUpgrade;

#[cfg(all(
not(target_arch = "wasm32"),
Expand Down Expand Up @@ -333,7 +332,7 @@ macro_rules! impl_tcp_noise_builder {
Ok(construct_quic_builder!(
self,
$tcp,
MapUpgrade::new(
map::Upgrade::new(
libp2p_core::upgrade::SelectUpgrade::new(
self.phase.tls_config,
libp2p_noise::Config::new(&self.keypair)
Expand Down Expand Up @@ -953,7 +952,7 @@ impl<Provider, T: AuthenticatedMultiplexedTransport>
> {
Ok(construct_websocket_builder!(
self,
MapUpgrade::new(
map::Upgrade::new(
libp2p_core::upgrade::SelectUpgrade::new(
self.phase.tls_config,
libp2p_noise::Config::new(&self.keypair)
Expand Down Expand Up @@ -1220,7 +1219,7 @@ macro_rules! impl_websocket_noise_builder {
construct_behaviour_builder!(
self,
$dnsTcp,
MapUpgrade::new(
map::Upgrade::new(
libp2p_core::upgrade::SelectUpgrade::new(
self.phase.tls_config,
libp2p_noise::Config::new(&self.keypair).map_err(|e| WebsocketError(AuthenticationErrorInner::from(e).into()))?,
Expand Down
12 changes: 6 additions & 6 deletions libp2p/src/builder/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ use futures::future::{self, TryFutureExt};

/// Upgrade applying a function to an inner upgrade.
#[derive(Debug, Clone)]
pub(crate) struct Map<U, F> {
pub(crate) struct Upgrade<U, F> {
upgrade: U,
fun: F,
}

impl<U, F> Map<U, F> {
impl<U, F> Upgrade<U, F> {
/// Applies the function on the result of the upgrade.
pub fn new(upgrade: U, fun: F) -> Self {

Check failure on line 33 in libp2p/src/builder/map.rs

View workflow job for this annotation

GitHub Actions / clippy (beta)

unreachable `pub` item

Check failure on line 33 in libp2p/src/builder/map.rs

View workflow job for this annotation

GitHub Actions / clippy (1.71.0)

unreachable `pub` item
Map { upgrade, fun }
Upgrade { upgrade, fun }
}
}

impl<U, F> UpgradeInfo for Map<U, F>
impl<U, F> UpgradeInfo for Upgrade<U, F>
where
U: UpgradeInfo,
{
Expand All @@ -47,7 +47,7 @@ where
}
}

impl<U, F, C, D> InboundUpgrade<C> for Map<U, F>
impl<U, F, C, D> InboundUpgrade<C> for Upgrade<U, F>
where
U: InboundUpgrade<C>,
F: FnOnce(U::Output) -> D,
Expand All @@ -61,7 +61,7 @@ where
}
}

impl<U, F, C, D> OutboundUpgrade<C> for Map<U, F>
impl<U, F, C, D> OutboundUpgrade<C> for Upgrade<U, F>
where
U: OutboundUpgrade<C>,
F: FnOnce(U::Output) -> D,
Expand Down

0 comments on commit a80d726

Please sign in to comment.