Skip to content

Commit fbef012

Browse files
Small style fix
1 parent b892a48 commit fbef012

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

crates/rust-analyzer/src/main_loop.rs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -416,20 +416,27 @@ fn loop_turn(
416416

417417
if Some(resp.id) == loop_state.configuration_request_id {
418418
loop_state.configuration_request_id = None;
419-
if let Some(err) = resp.error {
420-
log::error!("failed to fetch the server settings: {:?}", err)
421-
} else if let Some(result) = resp.result {
422-
let new_config = serde_json::from_value::<Vec<ServerConfig>>(result)?
423-
.first()
424-
.expect("The client is expected to always send a non-empty config data")
425-
.to_owned();
426-
world_state.update_configuration(
427-
new_config.lru_capacity,
428-
get_options(&new_config, text_document_caps),
429-
get_feature_flags(&new_config, connection),
430-
);
431-
} else {
432-
log::error!("received empty server settings response from the client")
419+
let Response { error, result, .. } = resp;
420+
match (error, result) {
421+
(Some(err), _) => {
422+
log::error!("failed to fetch the server settings: {:?}", err)
423+
}
424+
(None, Some(result)) => {
425+
let new_config = serde_json::from_value::<Vec<ServerConfig>>(result)?
426+
.first()
427+
.expect(
428+
"The client is expected to always send a non-empty config data",
429+
)
430+
.to_owned();
431+
world_state.update_configuration(
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+
}
433440
}
434441
}
435442
}

0 commit comments

Comments
 (0)