]> git.lizzy.rs Git - rust.git/commitdiff
Small style fix
authorKirill Bulatov <mail4score@gmail.com>
Tue, 24 Mar 2020 19:06:03 +0000 (21:06 +0200)
committerKirill Bulatov <mail4score@gmail.com>
Mon, 30 Mar 2020 10:39:14 +0000 (13:39 +0300)
crates/rust-analyzer/src/main_loop.rs

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