From 569f47e427e0b9181075291c988446b86c5ba8f9 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Mar 2020 16:02:55 +0200 Subject: Better names for config structs --- crates/ra_cargo_watch/src/lib.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'crates/ra_cargo_watch') 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}; pub use crate::conv::url_from_path_with_drive_lowercasing; #[derive(Clone, Debug)] -pub struct CheckOptions { +pub struct CheckConfig { pub enable: bool, pub args: Vec, pub command: String, @@ -42,13 +42,11 @@ pub struct CheckWatcher { } impl CheckWatcher { - pub fn new(options: &CheckOptions, workspace_root: PathBuf) -> CheckWatcher { - let options = options.clone(); - + pub fn new(config: CheckConfig, workspace_root: PathBuf) -> CheckWatcher { let (task_send, task_recv) = unbounded::(); let (cmd_send, cmd_recv) = unbounded::(); let handle = jod_thread::spawn(move || { - let mut check = CheckWatcherThread::new(options, workspace_root); + let mut check = CheckWatcherThread::new(config, workspace_root); check.run(&task_send, &cmd_recv); }); CheckWatcher { task_recv, cmd_send, handle: Some(handle) } @@ -78,14 +76,14 @@ pub enum CheckCommand { } struct CheckWatcherThread { - options: CheckOptions, + options: CheckConfig, workspace_root: PathBuf, watcher: WatchThread, last_update_req: Option, } impl CheckWatcherThread { - fn new(options: CheckOptions, workspace_root: PathBuf) -> CheckWatcherThread { + fn new(options: CheckConfig, workspace_root: PathBuf) -> CheckWatcherThread { CheckWatcherThread { options, workspace_root, @@ -324,7 +322,7 @@ impl WatchThread { WatchThread { message_recv: never(), _handle: None } } - fn new(options: &CheckOptions, workspace_root: &Path) -> WatchThread { + fn new(options: &CheckConfig, workspace_root: &Path) -> WatchThread { let mut args: Vec = vec![ options.command.clone(), "--workspace".to_string(), -- cgit v1.2.3