From c1ba76f44b452a0b0a3fa6c9567bf3f5419af627 Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Wed, 20 Jul 2022 17:19:41 +0200 Subject: [PATCH] Remove unnecessary Arc-ing --- muxers/mplex/tests/async_write.rs | 3 +-- muxers/mplex/tests/two_peers.rs | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/muxers/mplex/tests/async_write.rs b/muxers/mplex/tests/async_write.rs index 94d69cd7ff1..2c4a2d10f0d 100644 --- a/muxers/mplex/tests/async_write.rs +++ b/muxers/mplex/tests/async_write.rs @@ -22,7 +22,6 @@ use futures::future::poll_fn; use futures::{channel::oneshot, prelude::*}; use libp2p_core::{upgrade, StreamMuxer, Transport}; use libp2p_tcp::TcpTransport; -use std::sync::Arc; #[test] fn async_write() { @@ -72,7 +71,7 @@ fn async_write() { let mut transport = TcpTransport::default() .and_then(move |c, e| upgrade::apply(c, mplex, e, upgrade::Version::V1)); - let client = Arc::new(transport.dial(rx.await.unwrap()).unwrap().await.unwrap()); + let client = transport.dial(rx.await.unwrap()).unwrap().await.unwrap(); let mut inbound = poll_fn(|cx| client.poll_inbound(cx)).await.unwrap(); inbound.write_all(b"hello world").await.unwrap(); diff --git a/muxers/mplex/tests/two_peers.rs b/muxers/mplex/tests/two_peers.rs index 20812fde55c..2b976c12fea 100644 --- a/muxers/mplex/tests/two_peers.rs +++ b/muxers/mplex/tests/two_peers.rs @@ -22,7 +22,6 @@ use futures::future::poll_fn; use futures::{channel::oneshot, prelude::*}; use libp2p_core::{upgrade, StreamMuxer, Transport}; use libp2p_tcp::TcpTransport; -use std::sync::Arc; #[test] fn client_to_server_outbound() { @@ -73,7 +72,7 @@ fn client_to_server_outbound() { .and_then(move |c, e| upgrade::apply(c, mplex, e, upgrade::Version::V1)) .boxed(); - let client = Arc::new(transport.dial(rx.await.unwrap()).unwrap().await.unwrap()); + let client = transport.dial(rx.await.unwrap()).unwrap().await.unwrap(); let mut inbound = poll_fn(|cx| client.poll_inbound(cx)).await.unwrap(); inbound.write_all(b"hello world").await.unwrap(); inbound.close().await.unwrap(); @@ -108,17 +107,15 @@ fn client_to_server_inbound() { tx.send(addr).unwrap(); - let client = Arc::new( - transport - .next() - .await - .expect("some event") - .into_incoming() - .unwrap() - .0 - .await - .unwrap(), - ); + let client = transport + .next() + .await + .expect("some event") + .into_incoming() + .unwrap() + .0 + .await + .unwrap(); let mut inbound = poll_fn(|cx| client.poll_inbound(cx)).await.unwrap();