diff --git a/src/args.rs b/src/args.rs index 9636fa84..939b3b79 100644 --- a/src/args.rs +++ b/src/args.rs @@ -1,13 +1,13 @@ -use clap::{App, Arg, value_t, values_t, crate_version}; +use clap::{crate_version, value_t, values_t, App, Arg}; use log::LevelFilter; use std::{ ffi::OsString, path::{PathBuf, MAIN_SEPARATOR}, }; -use crate::{error, Shell}; use crate::config::{Config, ConfigBuilder}; use crate::run::OnBusyUpdate; +use crate::{error, Shell}; pub fn get_args() -> error::Result<(Config, LevelFilter)> { get_args_impl(None::<&[&str]>) @@ -146,7 +146,8 @@ where let mut builder = ConfigBuilder::default(); - let cmd: Vec = values_t!(args.values_of("command"), String).map_err(|err| err.to_string())?; + let cmd: Vec = + values_t!(args.values_of("command"), String).map_err(|err| err.to_string())?; builder.cmd(cmd); let paths: Vec = values_t!(args.values_of("path"), String) @@ -167,7 +168,8 @@ where let mut filters = values_t!(args.values_of("filter"), String).unwrap_or_else(|_| Vec::new()); if let Some(extensions) = args.values_of("extensions") { - for exts in extensions { // TODO: refactor with flatten() + for exts in extensions { + // TODO: refactor with flatten() filters.extend(exts.split(',').filter_map(|ext| { if ext.is_empty() { None @@ -219,7 +221,7 @@ where b"queue" => OnBusyUpdate::Queue, b"restart" => OnBusyUpdate::Restart, b"signal" => OnBusyUpdate::Signal, - _ => unreachable!("clap restricts on-busy-updates values") + _ => unreachable!("clap restricts on-busy-updates values"), } } else { // will become DoNothing in v2.0 diff --git a/src/cli.rs b/src/cli.rs index 7d5ee697..a447a2bd 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -7,13 +7,16 @@ use crate::config::{Config, ConfigBuilder}; #[deprecated(since = "1.15.0", note = "Config has moved to config::Config")] pub type Args = Config; -#[deprecated(since = "1.15.0", note = "ConfigBuilder has moved to config::ConfigBuilder")] +#[deprecated( + since = "1.15.0", + note = "ConfigBuilder has moved to config::ConfigBuilder" +)] pub type ArgsBuilder = ConfigBuilder; /// Clear the screen. #[cfg(target_family = "windows")] pub fn clear_screen() { -// TODO: clearscreen with powershell? + // TODO: clearscreen with powershell? let _ = Command::new("cmd") .arg("/c") .arg("tput reset || cls") @@ -23,12 +26,18 @@ pub fn clear_screen() { /// Clear the screen. #[cfg(target_family = "unix")] pub fn clear_screen() { -// TODO: clear screen via control codes instead + // TODO: clear screen via control codes instead let _ = Command::new("tput").arg("reset").status(); } -#[deprecated(since = "1.15.0", note = "this will be removed from the library API. use the builder")] +#[deprecated( + since = "1.15.0", + note = "this will be removed from the library API. use the builder" +)] pub use crate::args::get_args; -#[deprecated(since = "1.15.0", note = "this will be removed from the library API. use the builder")] +#[deprecated( + since = "1.15.0", + note = "this will be removed from the library API. use the builder" +)] pub use crate::args::get_args_from; diff --git a/src/lib.rs b/src/lib.rs index bbc4031e..f951997b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,10 +9,7 @@ //! //! [watchexec]: https://github.com/watchexec/watchexec -#![warn( - clippy::option_unwrap_used, - clippy::result_unwrap_used, -)] +#![warn(clippy::option_unwrap_used, clippy::result_unwrap_used)] #[macro_use] extern crate derive_builder; @@ -40,5 +37,8 @@ pub use run::{run, watch, Handler}; #[deprecated(since = "1.15.0", note = "Config has moved to config::Config")] pub type Args = config::Config; -#[deprecated(since = "1.15.0", note = "ConfigBuilder has moved to config::ConfigBuilder")] +#[deprecated( + since = "1.15.0", + note = "ConfigBuilder has moved to config::ConfigBuilder" +)] pub type ArgsBuilder = config::ConfigBuilder; diff --git a/src/main.rs b/src/main.rs index 347d419a..b9603790 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ use std::io::Write; // until args.rs is removed from the lib -pub(crate) use watchexec::{error, config, run, Shell}; +pub(crate) use watchexec::{config, error, run, Shell}; mod args; diff --git a/src/run.rs b/src/run.rs index 7dad4e4a..849e2e53 100644 --- a/src/run.rs +++ b/src/run.rs @@ -1,4 +1,4 @@ -use crate::cli::{clear_screen}; +use crate::cli::clear_screen; use crate::config::Config; use crate::error::{Error, Result}; use crate::gitignore; @@ -231,10 +231,7 @@ impl Handler for ExecHandler { fn on_update(&self, ops: &[PathOp]) -> Result { let signal = self.signal.unwrap_or(Signal::SIGTERM); - match ( - self.has_running_process(), - self.args.on_busy_update, - ) { + match (self.has_running_process(), self.args.on_busy_update) { // If nothing is running, start the command (false, _) => { self.spawn(ops)?;