diff options
author | Kirill Bulatov <[email protected]> | 2020-03-21 22:40:07 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-03-30 11:39:14 +0100 |
commit | b892a48740eef7a505bfbe2213c42c71e87f0bea (patch) | |
tree | 8f7115e538c3b21407eb17c604636eb3bb6362c8 /crates | |
parent | 590af37bff2b5ec9a692f2468c98acf7f9f492c0 (diff) |
Code review fixes
Co-Authored-By: Veetaha <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 21 | ||||
-rw-r--r-- | crates/rust-analyzer/src/world.rs | 1 |
2 files changed, 10 insertions, 12 deletions
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index e1fcae136..7e96be319 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs | |||
@@ -417,22 +417,19 @@ fn loop_turn( | |||
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 | if let Some(err) = resp.error { |
420 | log::error!("failed fetch the server settings: {:?}", err) | 420 | log::error!("failed to fetch the server settings: {:?}", err) |
421 | } else if resp.result.is_none() { | 421 | } else if let Some(result) = resp.result { |
422 | log::error!("received empty server settings response from the client") | 422 | let new_config = serde_json::from_value::<Vec<ServerConfig>>(result)? |
423 | } else { | 423 | .first() |
424 | let new_config = | 424 | .expect("The client is expected to always send a non-empty config data") |
425 | serde_json::from_value::<Vec<ServerConfig>>(resp.result.unwrap())? | 425 | .to_owned(); |
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( | 426 | world_state.update_configuration( |
432 | new_config.lru_capacity, | 427 | new_config.lru_capacity, |
433 | get_options(&new_config, text_document_caps), | 428 | get_options(&new_config, text_document_caps), |
434 | get_feature_flags(&new_config, connection), | 429 | get_feature_flags(&new_config, connection), |
435 | ); | 430 | ); |
431 | } else { | ||
432 | log::error!("received empty server settings response from the client") | ||
436 | } | 433 | } |
437 | } | 434 | } |
438 | } | 435 | } |
@@ -673,7 +670,7 @@ fn on_notification( | |||
673 | ConfigurationParams::default(), | 670 | ConfigurationParams::default(), |
674 | ); | 671 | ); |
675 | msg_sender.send(request.into())?; | 672 | msg_sender.send(request.into())?; |
676 | loop_state.configuration_request_id.replace(request_id); | 673 | loop_state.configuration_request_id = Some(request_id); |
677 | 674 | ||
678 | return Ok(()); | 675 | return Ok(()); |
679 | } | 676 | } |
diff --git a/crates/rust-analyzer/src/world.rs b/crates/rust-analyzer/src/world.rs index 2b5878ed9..01084f818 100644 --- a/crates/rust-analyzer/src/world.rs +++ b/crates/rust-analyzer/src/world.rs | |||
@@ -32,6 +32,7 @@ use ra_db::ExternSourceId; | |||
32 | use rustc_hash::{FxHashMap, FxHashSet}; | 32 | use rustc_hash::{FxHashMap, FxHashSet}; |
33 | 33 | ||
34 | fn create_watcher(workspaces: &[ProjectWorkspace], options: &Options) -> CheckWatcher { | 34 | fn create_watcher(workspaces: &[ProjectWorkspace], options: &Options) -> CheckWatcher { |
35 | // FIXME: Figure out the multi-workspace situation | ||
35 | workspaces | 36 | workspaces |
36 | .iter() | 37 | .iter() |
37 | .find_map(|w| match w { | 38 | .find_map(|w| match w { |