diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-18 05:45:06 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-18 05:45:06 +0100 |
commit | f5af48dc49dc4066a06e1b565c343de910131f40 (patch) | |
tree | 3d313d62f232efc49158b8a47934a75c4491a600 | |
parent | 1ce8c2b5a08949e78de7ff9dfbae594f6c17b951 (diff) | |
parent | 9bb028189ae015c73615383050c13bbc4a1dbace (diff) |
Merge #4932
4932: Simplify r=matklad a=Veetaha
Co-authored-by: Veetaha <[email protected]>
-rw-r--r-- | crates/rust-analyzer/src/global_state.rs | 16 |
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 | ||
34 | fn create_flycheck(workspaces: &[ProjectWorkspace], config: &FlycheckConfig) -> Option<Flycheck> { | 34 | fn 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 |