aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_cargo_watch/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-03-31 15:02:55 +0100
committerAleksey Kladov <[email protected]>2020-03-31 15:05:25 +0100
commit569f47e427e0b9181075291c988446b86c5ba8f9 (patch)
treeb42d2b36b4583f306dbe7fc5a77b7522564cd38a /crates/ra_cargo_watch/src
parentf5b01d6544681a9db157b1a9a33c29149d4c590c (diff)
Better names for config structs
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(),