Skip to content

Commit bd96d19

Browse files
committed
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 ```
1 parent 3265bb5 commit bd96d19

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

futures-util/benches/select.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@ fn select_streams(b: &mut Bencher) {
1818
let stream5 = repeat(5).take(STREAM_COUNT);
1919
let stream6 = repeat(6).take(STREAM_COUNT);
2020
let stream7 = repeat(7).take(STREAM_COUNT);
21-
let count = block_on(async {
21+
let count = block_on(
2222
select(
2323
stream1,
2424
select(
2525
stream2,
2626
select(stream3, select(stream4, select(stream5, select(stream6, stream7)))),
2727
),
2828
)
29-
.count()
30-
.await
31-
});
29+
.count(),
30+
);
3231
assert_eq!(count, STREAM_COUNT * 7);
3332
});
3433
}

futures/tests/compat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use tokio::timer::Delay;
99

1010
#[test]
1111
fn can_use_01_futures_in_a_03_future_running_on_a_01_executor() {
12-
let f = async { Delay::new(Instant::now()).compat().await };
12+
let f = Delay::new(Instant::now()).compat();
1313

1414
let mut runtime = Runtime::new().unwrap();
1515
runtime.block_on(f.boxed().compat()).unwrap();

0 commit comments

Comments
 (0)