aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cargo_watch/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-03-31 15:06:03 +0100
committerGitHub <[email protected]>2020-03-31 15:06:03 +0100
commitfa3c7742af9fbfe5146f4158a6119fa727dcc87a (patch)
tree897858f9eae6d759f5bc7187a18a70ecb8a45cc3 /crates/ra_cargo_watch/src
parent6546edc0651260f74a7e0c121120c487791d7f6d (diff)
parent569f47e427e0b9181075291c988446b86c5ba8f9 (diff)
Merge #3790
3790: Better names for config structs r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_cargo_watch/src')
-rw-r--r--crates/ra_cargo_watch/src/lib.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/crates/ra_cargo_watch/src/lib.rs b/crates/ra_cargo_watch/src/lib.rs
index 2692c1bf5..77ede8f63 100644
--- a/crates/ra_cargo_watch/src/lib.rs
+++ b/crates/ra_cargo_watch/src/lib.rs
@@ -22,7 +22,7 @@ use crate::conv::{map_rust_diagnostic_to_lsp, MappedRustDiagnostic};
22pub use crate::conv::url_from_path_with_drive_lowercasing; 22pub use crate::conv::url_from_path_with_drive_lowercasing;
23 23
24#[derive(Clone, Debug)] 24#[derive(Clone, Debug)]
25pub struct CheckOptions { 25pub struct CheckConfig {
26 pub enable: bool, 26 pub enable: bool,
27 pub args: Vec<String>, 27 pub args: Vec<String>,
28 pub command: String, 28 pub command: String,
@@ -42,13 +42,11 @@ pub struct CheckWatcher {
42} 42}
43 43
44impl CheckWatcher { 44impl CheckWatcher {
45 pub fn new(options: &CheckOptions, workspace_root: PathBuf) -> CheckWatcher { 45 pub fn new(config: CheckConfig, workspace_root: PathBuf) -> CheckWatcher {
46 let options = options.clone();
47
48 let (task_send, task_recv) = unbounded::<CheckTask>(); 46 let (task_send, task_recv) = unbounded::<CheckTask>();
49 let (cmd_send, cmd_recv) = unbounded::<CheckCommand>(); 47 let (cmd_send, cmd_recv) = unbounded::<CheckCommand>();
50 let handle = jod_thread::spawn(move || { 48 let handle = jod_thread::spawn(move || {
51 let mut check = CheckWatcherThread::new(options, workspace_root); 49 let mut check = CheckWatcherThread::new(config, workspace_root);
52 check.run(&task_send, &cmd_recv); 50 check.run(&task_send, &cmd_recv);
53 }); 51 });
54 CheckWatcher { task_recv, cmd_send, handle: Some(handle) } 52 CheckWatcher { task_recv, cmd_send, handle: Some(handle) }
@@ -78,14 +76,14 @@ pub enum CheckCommand {
78} 76}
79 77
80struct CheckWatcherThread { 78struct CheckWatcherThread {
81 options: CheckOptions, 79 options: CheckConfig,
82 workspace_root: PathBuf, 80 workspace_root: PathBuf,
83 watcher: WatchThread, 81 watcher: WatchThread,
84 last_update_req: Option<Instant>, 82 last_update_req: Option<Instant>,
85} 83}
86 84
87impl CheckWatcherThread { 85impl CheckWatcherThread {
88 fn new(options: CheckOptions, workspace_root: PathBuf) -> CheckWatcherThread { 86 fn new(options: CheckConfig, workspace_root: PathBuf) -> CheckWatcherThread {
89 CheckWatcherThread { 87 CheckWatcherThread {
90 options, 88 options,
91 workspace_root, 89 workspace_root,
@@ -324,7 +322,7 @@ impl WatchThread {
324 WatchThread { message_recv: never(), _handle: None } 322 WatchThread { message_recv: never(), _handle: None }
325 } 323 }
326 324
327 fn new(options: &CheckOptions, workspace_root: &Path) -> WatchThread { 325 fn new(options: &CheckConfig, workspace_root: &Path) -> WatchThread {
328 let mut args: Vec<String> = vec![ 326 let mut args: Vec<String> = vec![
329 options.command.clone(), 327 options.command.clone(),
330 "--workspace".to_string(), 328 "--workspace".to_string(),