This commit is contained in:
Antonio Scandurra 2022-01-10 16:10:29 +01:00
parent b44ae46559
commit 4992a8a407

View file

@ -848,14 +848,13 @@ mod tests {
let server = FakeServer::for_client(user_id, &mut client, &cx).await; let server = FakeServer::for_client(user_id, &mut client, &cx).await;
let model = cx.add_model(|_| Model { subscription: None }); let model = cx.add_model(|_| Model { subscription: None });
let (done_tx, mut done_rx) = postage::oneshot::channel(); let (mut done_tx, mut done_rx) = postage::oneshot::channel();
let mut done_tx = Some(done_tx);
model.update(&mut cx, |model, cx| { model.update(&mut cx, |model, cx| {
model.subscription = Some(client.subscribe( model.subscription = Some(client.subscribe(
cx, cx,
move |model, _: TypedEnvelope<proto::Ping>, _, _| { move |model, _: TypedEnvelope<proto::Ping>, _, _| {
model.subscription.take(); model.subscription.take();
postage::sink::Sink::try_send(&mut done_tx.take().unwrap(), ()).unwrap(); postage::sink::Sink::try_send(&mut done_tx, ()).unwrap();
Ok(()) Ok(())
}, },
)); ));