aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-06-18 00:00:48 +0100
committerVeetaha <[email protected]>2020-06-18 00:00:48 +0100
commit9bb028189ae015c73615383050c13bbc4a1dbace (patch)
tree3d313d62f232efc49158b8a47934a75c4491a600
parent1ce8c2b5a08949e78de7ff9dfbae594f6c17b951 (diff)
Simplify
-rw-r--r--crates/rust-analyzer/src/global_state.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index ef6c7d44d..1fab5ea4f 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -33,20 +33,16 @@ use rustc_hash::{FxHashMap, FxHashSet};
33 33
34fn create_flycheck(workspaces: &[ProjectWorkspace], config: &FlycheckConfig) -> Option<Flycheck> { 34fn create_flycheck(workspaces: &[ProjectWorkspace], config: &FlycheckConfig) -> Option<Flycheck> {
35 // FIXME: Figure out the multi-workspace situation 35 // FIXME: Figure out the multi-workspace situation
36 workspaces 36 workspaces.iter().find_map(|w| match w {
37 .iter() 37 ProjectWorkspace::Cargo { cargo, .. } => {
38 .find_map(|w| match w {
39 ProjectWorkspace::Cargo { cargo, .. } => Some(cargo),
40 ProjectWorkspace::Json { .. } => None,
41 })
42 .map(|cargo| {
43 let cargo_project_root = cargo.workspace_root().to_path_buf(); 38 let cargo_project_root = cargo.workspace_root().to_path_buf();
44 Some(Flycheck::new(config.clone(), cargo_project_root)) 39 Some(Flycheck::new(config.clone(), cargo_project_root))
45 }) 40 }
46 .unwrap_or_else(|| { 41 ProjectWorkspace::Json { .. } => {
47 log::warn!("Cargo check watching only supported for cargo workspaces, disabling"); 42 log::warn!("Cargo check watching only supported for cargo workspaces, disabling");
48 None 43 None
49 }) 44 }
45 })
50} 46}
51 47
52/// `GlobalState` is the primary mutable state of the language server 48/// `GlobalState` is the primary mutable state of the language server