From dda942debe0ea178f07b75989b2ba6942786e218 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 1 Apr 2020 11:01:37 +0200 Subject: Pull enabled check up --- crates/ra_flycheck/src/lib.rs | 4 ---- crates/rust-analyzer/src/main_loop.rs | 13 ++++++++----- crates/rust-analyzer/src/world.rs | 6 ++++-- 3 files changed, 12 insertions(+), 11 deletions(-) (limited to 'crates') diff --git a/crates/ra_flycheck/src/lib.rs b/crates/ra_flycheck/src/lib.rs index f6f9171ad..b6bb9da4b 100644 --- a/crates/ra_flycheck/src/lib.rs +++ b/crates/ra_flycheck/src/lib.rs @@ -24,7 +24,6 @@ pub use crate::conv::url_from_path_with_drive_lowercasing; #[derive(Clone, Debug)] pub struct CheckConfig { - pub enable: bool, pub args: Vec, pub command: String, pub all_targets: bool, @@ -216,9 +215,6 @@ impl CheckWatcherThread { // First, clear and cancel the old thread self.message_recv = never(); self.check_process = None; - if !self.options.enable { - return; - } let mut args: Vec = vec![ self.options.command.clone(), diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index bb33fb27d..16d7f1569 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -101,11 +101,14 @@ fn get_config( chaining_hints: config.inlay_hints_chaining, max_length: config.inlay_hints_max_length, }, - check: CheckConfig { - enable: config.cargo_watch_enable, - args: config.cargo_watch_args.clone(), - command: config.cargo_watch_command.clone(), - all_targets: config.cargo_watch_all_targets, + check: if config.cargo_watch_enable { + Some(CheckConfig { + args: config.cargo_watch_args.clone(), + command: config.cargo_watch_command.clone(), + all_targets: config.cargo_watch_all_targets, + }) + } else { + None }, rustfmt_args: config.rustfmt_args.clone(), vscode_lldb: config.vscode_lldb, diff --git a/crates/rust-analyzer/src/world.rs b/crates/rust-analyzer/src/world.rs index acb729bae..9a4e353fb 100644 --- a/crates/rust-analyzer/src/world.rs +++ b/crates/rust-analyzer/src/world.rs @@ -32,6 +32,8 @@ use ra_db::ExternSourceId; use rustc_hash::{FxHashMap, FxHashSet}; fn create_watcher(workspaces: &[ProjectWorkspace], config: &Config) -> Option { + let check_config = config.check.as_ref()?; + // FIXME: Figure out the multi-workspace situation workspaces .iter() @@ -41,7 +43,7 @@ fn create_watcher(workspaces: &[ProjectWorkspace], config: &Config) -> Option, - pub check: CheckConfig, + pub check: Option, pub vscode_lldb: bool, pub proc_macro_srv: Option, } -- cgit v1.2.3