Small style fix

This commit is contained in:
Kirill Bulatov 2020-03-24 21:06:03 +02:00
parent b892a48740
commit fbef0127ba

View file

@ -416,23 +416,30 @@ fn loop_turn(
if Some(resp.id) == loop_state.configuration_request_id { if Some(resp.id) == loop_state.configuration_request_id {
loop_state.configuration_request_id = None; loop_state.configuration_request_id = None;
if let Some(err) = resp.error { let Response { error, result, .. } = resp;
match (error, result) {
(Some(err), _) => {
log::error!("failed to fetch the server settings: {:?}", err) log::error!("failed to fetch the server settings: {:?}", err)
} else if let Some(result) = resp.result { }
(None, Some(result)) => {
let new_config = serde_json::from_value::<Vec<ServerConfig>>(result)? let new_config = serde_json::from_value::<Vec<ServerConfig>>(result)?
.first() .first()
.expect("The client is expected to always send a non-empty config data") .expect(
"The client is expected to always send a non-empty config data",
)
.to_owned(); .to_owned();
world_state.update_configuration( world_state.update_configuration(
new_config.lru_capacity, new_config.lru_capacity,
get_options(&new_config, text_document_caps), get_options(&new_config, text_document_caps),
get_feature_flags(&new_config, connection), get_feature_flags(&new_config, connection),
); );
} else { }
(None, None) => {
log::error!("received empty server settings response from the client") log::error!("received empty server settings response from the client")
} }
} }
} }
}
}, },
}; };