1
Fork 0

Remove unnecessary lets and borrowing from Waker::noop() usage.

`Waker::noop()` now returns a `&'static Waker` reference, so it can be
passed directly to `Context` creation with no temporary lifetime issue.
This commit is contained in:
Kevin Reid 2024-01-14 16:25:43 -08:00
parent 6f8a944ba4
commit c48cdfe8ee
22 changed files with 24 additions and 46 deletions

View file

@ -110,8 +110,7 @@ mod executor {
#[coverage(off)]
pub fn block_on<F: Future>(mut future: F) -> F::Output {
let mut future = pin!(future);
let waker = Waker::noop();
let mut context = Context::from_waker(&waker);
let mut context = Context::from_waker(Waker::noop());
loop {
if let Poll::Ready(val) = future.as_mut().poll(&mut context) {