Skip to content

Commit dda942d

Browse files
committed
Pull enabled check up
1 parent fae6cec commit dda942d

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

crates/ra_flycheck/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pub use crate::conv::url_from_path_with_drive_lowercasing;
2424

2525
#[derive(Clone, Debug)]
2626
pub struct CheckConfig {
27-
pub enable: bool,
2827
pub args: Vec<String>,
2928
pub command: String,
3029
pub all_targets: bool,
@@ -216,9 +215,6 @@ impl CheckWatcherThread {
216215
// First, clear and cancel the old thread
217216
self.message_recv = never();
218217
self.check_process = None;
219-
if !self.options.enable {
220-
return;
221-
}
222218

223219
let mut args: Vec<String> = vec![
224220
self.options.command.clone(),

crates/rust-analyzer/src/main_loop.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,14 @@ fn get_config(
101101
chaining_hints: config.inlay_hints_chaining,
102102
max_length: config.inlay_hints_max_length,
103103
},
104-
check: CheckConfig {
105-
enable: config.cargo_watch_enable,
106-
args: config.cargo_watch_args.clone(),
107-
command: config.cargo_watch_command.clone(),
108-
all_targets: config.cargo_watch_all_targets,
104+
check: if config.cargo_watch_enable {
105+
Some(CheckConfig {
106+
args: config.cargo_watch_args.clone(),
107+
command: config.cargo_watch_command.clone(),
108+
all_targets: config.cargo_watch_all_targets,
109+
})
110+
} else {
111+
None
109112
},
110113
rustfmt_args: config.rustfmt_args.clone(),
111114
vscode_lldb: config.vscode_lldb,

crates/rust-analyzer/src/world.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ use ra_db::ExternSourceId;
3232
use rustc_hash::{FxHashMap, FxHashSet};
3333

3434
fn create_watcher(workspaces: &[ProjectWorkspace], config: &Config) -> Option<CheckWatcher> {
35+
let check_config = config.check.as_ref()?;
36+
3537
// FIXME: Figure out the multi-workspace situation
3638
workspaces
3739
.iter()
@@ -41,7 +43,7 @@ fn create_watcher(workspaces: &[ProjectWorkspace], config: &Config) -> Option<Ch
4143
})
4244
.map(|cargo| {
4345
let cargo_project_root = cargo.workspace_root().to_path_buf();
44-
Some(CheckWatcher::new(config.check.clone(), cargo_project_root))
46+
Some(CheckWatcher::new(check_config.clone(), cargo_project_root))
4547
})
4648
.unwrap_or_else(|| {
4749
log::warn!("Cargo check watching only supported for cargo workspaces, disabling");
@@ -56,7 +58,7 @@ pub struct Config {
5658
pub line_folding_only: bool,
5759
pub inlay_hints: InlayHintsConfig,
5860
pub rustfmt_args: Vec<String>,
59-
pub check: CheckConfig,
61+
pub check: Option<CheckConfig>,
6062
pub vscode_lldb: bool,
6163
pub proc_macro_srv: Option<String>,
6264
}

0 commit comments

Comments
 (0)