From 9bb028189ae015c73615383050c13bbc4a1dbace Mon Sep 17 00:00:00 2001 From: Veetaha Date: Thu, 18 Jun 2020 02:00:48 +0300 Subject: Simplify --- crates/rust-analyzer/src/global_state.rs | 16 ++++++---------- 1 file 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}; fn create_flycheck(workspaces: &[ProjectWorkspace], config: &FlycheckConfig) -> Option { // FIXME: Figure out the multi-workspace situation - workspaces - .iter() - .find_map(|w| match w { - ProjectWorkspace::Cargo { cargo, .. } => Some(cargo), - ProjectWorkspace::Json { .. } => None, - }) - .map(|cargo| { + workspaces.iter().find_map(|w| match w { + ProjectWorkspace::Cargo { cargo, .. } => { let cargo_project_root = cargo.workspace_root().to_path_buf(); Some(Flycheck::new(config.clone(), cargo_project_root)) - }) - .unwrap_or_else(|| { + } + ProjectWorkspace::Json { .. } => { log::warn!("Cargo check watching only supported for cargo workspaces, disabling"); None - }) + } + }) } /// `GlobalState` is the primary mutable state of the language server -- cgit v1.2.3