mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-07-24 07:21:02 -04:00
Don't unnecessarily create async blocks
If our expression directly evaluates to a future, we don't need to create an async block. This requires us to have `EventLoopRun::run` consume the instance instead of just taking a mutable reference (otherwise we run into lifetime issues). However, that is better anyway because `run` is an endless loop so you never get to use the handle afterwards anyway.
This commit is contained in:
parent
a4c25080b6
commit
54bc91581f
4 changed files with 8 additions and 10 deletions
|
@ -103,7 +103,7 @@ impl TestContext {
|
|||
.await
|
||||
.unwrap();
|
||||
|
||||
let join_handle = tokio::spawn(async move { event_loop.run().await });
|
||||
let join_handle = tokio::spawn(event_loop.run());
|
||||
|
||||
(swap, BobEventLoopJoinHandle(join_handle))
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ impl TestContext {
|
|||
|
||||
let (swap, event_loop) = self.bob_params.builder().build().await.unwrap();
|
||||
|
||||
let join_handle = tokio::spawn(async move { event_loop.run().await });
|
||||
let join_handle = tokio::spawn(event_loop.run());
|
||||
|
||||
(swap, BobEventLoopJoinHandle(join_handle))
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ where
|
|||
)
|
||||
.await;
|
||||
|
||||
let (mut alice_event_loop, alice_swap_handle) = alice::EventLoop::new(
|
||||
let (alice_event_loop, alice_swap_handle) = alice::EventLoop::new(
|
||||
alice_listen_address.clone(),
|
||||
alice_seed,
|
||||
execution_params,
|
||||
|
@ -390,9 +390,7 @@ where
|
|||
|
||||
let alice_peer_id = alice_event_loop.peer_id();
|
||||
|
||||
tokio::spawn(async move {
|
||||
alice_event_loop.run().await;
|
||||
});
|
||||
tokio::spawn(alice_event_loop.run());
|
||||
|
||||
let bob_params = BobParams {
|
||||
seed: Seed::random().unwrap(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue