aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-03-24 19:06:03 +0000
committerKirill Bulatov <[email protected]>2020-03-30 11:39:14 +0100
commitfbef0127ba89e44796ca9594435fd01bbe77c36d (patch)
tree81999ed03245179b26df405bba3b6bf013223454
parentb892a48740eef7a505bfbe2213c42c71e87f0bea (diff)
Small style fix
-rw-r--r--crates/rust-analyzer/src/main_loop.rs35
1 files changed, 21 insertions, 14 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index 7e96be319..0ab5b9ef5 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -416,20 +416,27 @@ fn loop_turn(
416 416
417 if Some(resp.id) == loop_state.configuration_request_id { 417 if Some(resp.id) == loop_state.configuration_request_id {
418 loop_state.configuration_request_id = None; 418 loop_state.configuration_request_id = None;
419 if let Some(err) = resp.error { 419 let Response { error, result, .. } = resp;
420 log::error!("failed to fetch the server settings: {:?}", err) 420 match (error, result) {
421 } else if let Some(result) = resp.result { 421 (Some(err), _) => {
422 let new_config = serde_json::from_value::<Vec<ServerConfig>>(result)? 422 log::error!("failed to fetch the server settings: {:?}", err)
423 .first() 423 }
424 .expect("The client is expected to always send a non-empty config data") 424 (None, Some(result)) => {
425 .to_owned(); 425 let new_config = serde_json::from_value::<Vec<ServerConfig>>(result)?
426 world_state.update_configuration( 426 .first()
427 new_config.lru_capacity, 427 .expect(
428 get_options(&new_config, text_document_caps), 428 "The client is expected to always send a non-empty config data",
429 get_feature_flags(&new_config, connection), 429 )
430 ); 430 .to_owned();
431 } else { 431 world_state.update_configuration(
432 log::error!("received empty server settings response from the client") 432 new_config.lru_capacity,
433 get_options(&new_config, text_document_caps),
434 get_feature_flags(&new_config, connection),
435 );
436 }
437 (None, None) => {
438 log::error!("received empty server settings response from the client")
439 }
433 } 440 }
434 } 441 }
435 } 442 }