mirror of
https://github.com/rust-lang/futures-rs.git
synced 2026-01-25 03:26:14 +00:00
Fix clippy::redundant_async_block warning
```
warning: this async expression only awaits a single future
--> futures-util/benches/select.rs:21:30
|
21 | let count = block_on(async {
| ______________________________^
22 | | select(
23 | | stream1,
24 | | select(
... |
30 | | .await
31 | | });
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_async_block
= note: `#[warn(clippy::redundant_async_block)]` on by default
help: you can reduce it to
|
21 ~ let count = block_on(select(
22 + stream1,
23 + select(
24 + stream2,
25 + select(stream3, select(stream4, select(stream5, select(stream6, stream7)))),
26 + ),
27 + )
28 ~ .count());
|
warning: this async expression only awaits a single future
--> futures/tests/compat.rs:12:13
|
12 | let f = async { Delay::new(Instant::now()).compat().await };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `Delay::new(Instant::now()).compat()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_async_block
= note: `#[warn(clippy::redundant_async_block)]` on by default
```
This commit is contained in:
@@ -18,7 +18,7 @@ fn select_streams(b: &mut Bencher) {
|
||||
let stream5 = repeat(5).take(STREAM_COUNT);
|
||||
let stream6 = repeat(6).take(STREAM_COUNT);
|
||||
let stream7 = repeat(7).take(STREAM_COUNT);
|
||||
let count = block_on(async {
|
||||
let count = block_on(
|
||||
select(
|
||||
stream1,
|
||||
select(
|
||||
@@ -26,9 +26,8 @@ fn select_streams(b: &mut Bencher) {
|
||||
select(stream3, select(stream4, select(stream5, select(stream6, stream7)))),
|
||||
),
|
||||
)
|
||||
.count()
|
||||
.await
|
||||
});
|
||||
.count(),
|
||||
);
|
||||
assert_eq!(count, STREAM_COUNT * 7);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ use tokio::timer::Delay;
|
||||
|
||||
#[test]
|
||||
fn can_use_01_futures_in_a_03_future_running_on_a_01_executor() {
|
||||
let f = async { Delay::new(Instant::now()).compat().await };
|
||||
let f = Delay::new(Instant::now()).compat();
|
||||
|
||||
let mut runtime = Runtime::new().unwrap();
|
||||
runtime.block_on(f.boxed().compat()).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user