mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 03:38:29 +00:00
simplify
This commit is contained in:
parent
e1bda6aeda
commit
2d773a46c9
@ -452,8 +452,15 @@ impl<'a> PoolDispatcher<'a> {
|
||||
None => return Ok(self),
|
||||
Some(req) => req,
|
||||
};
|
||||
match req.cast::<R>() {
|
||||
Ok((id, params)) => {
|
||||
let (id, params) = match req.cast::<R>() {
|
||||
Ok(it) => it,
|
||||
Err(req) => {
|
||||
self.req = Some(req);
|
||||
return Ok(self);
|
||||
}
|
||||
};
|
||||
self.res = Some(id);
|
||||
|
||||
// Real time requests block user typing, so we should react quickly to them.
|
||||
// Currently this means that we try to cancel background jobs if we don't have
|
||||
// a spare thread.
|
||||
@ -469,9 +476,7 @@ impl<'a> PoolDispatcher<'a> {
|
||||
let response = match f(world, params) {
|
||||
Ok(resp) => RawResponse::ok::<R>(id, &resp),
|
||||
Err(e) => match e.downcast::<LspError>() {
|
||||
Ok(lsp_error) => {
|
||||
RawResponse::err(id, lsp_error.code, lsp_error.message)
|
||||
}
|
||||
Ok(lsp_error) => RawResponse::err(id, lsp_error.code, lsp_error.message),
|
||||
Err(e) => {
|
||||
if is_canceled(&e) {
|
||||
// FIXME: When https://github.com/Microsoft/vscode-languageserver-node/issues/457
|
||||
@ -501,10 +506,6 @@ impl<'a> PoolDispatcher<'a> {
|
||||
let task = Task::Respond(response);
|
||||
sender.send(task).unwrap();
|
||||
});
|
||||
self.res = Some(id);
|
||||
}
|
||||
Err(req) => self.req = Some(req),
|
||||
}
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user