Skip to content

Commit dffde39

Browse files
committed
Replaced #![feature(async_closure)] with "async move { ... }"
1 parent 370fb18 commit dffde39

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

snocat-cli/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license OR Apache 2.0
3-
#![feature(async_closure)]
43
#![feature(backtrace)]
54
#![warn(unused_imports)]
65

snocat/src/common/protocol/tunnel/duplex.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,11 @@ mod tests {
168168
let (a_inc, b_inc) = futures::future::join(a_tun.downlink(), b_tun.downlink()).await;
169169
let (mut a_inc, mut b_inc) = (a_inc.unwrap(), b_inc.unwrap());
170170
drop(a_tun); // Dropping the A tunnel ends the incoming streams for B
171-
let count_of_b: u32 = b_inc
172-
.as_stream()
173-
.fold(0, async move |memo, _stream| memo + 1)
174-
.await;
171+
let count_of_b: usize = b_inc.as_stream().count().await;
175172
assert_eq!(count_of_b, 1);
176173
b_tun.open_link().await.unwrap();
177174
drop(b_tun); // Dropping the B tunnel ends the incoming streams for A
178-
let count_of_a: u32 = a_inc
179-
.as_stream()
180-
.fold(0, async move |memo, _stream| memo + 1)
181-
.await;
175+
let count_of_a: usize = a_inc.as_stream().count().await;
182176
assert_eq!(count_of_a, 1);
183177
};
184178
tokio::time::timeout(std::time::Duration::from_secs(5), fut)
@@ -217,7 +211,7 @@ mod tests {
217211
TunnelIncomingType::BiStream(stream) => Ok(Some(stream)),
218212
})
219213
})
220-
.try_for_each_concurrent(None, async move |stream: WrappedStream| {
214+
.try_for_each_concurrent(None, |stream: WrappedStream| async move {
221215
let (mut incoming_downlink, _incoming_uplink) = tokio::io::split(stream);
222216
let (_outgoing_downlink, mut outgoing_uplink) =
223217
tokio::io::split(server_ref.open_link().await.unwrap());

snocat/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT license OR Apache 2.0
33
#![cfg_attr(test, feature(assert_matches))]
4-
#![feature(async_closure)]
54
#![feature(backtrace)]
65
#![feature(generic_associated_types)]
76
#![feature(never_type)]

0 commit comments

Comments
 (0)