diff --git a/src/events.rs b/src/events.rs index 0120a8a..bdf9132 100644 --- a/src/events.rs +++ b/src/events.rs @@ -13,7 +13,7 @@ // limitations under the License. use notify::DebouncedEvent; -#[derive(PartialEq,Clone)] +#[derive(PartialEq, Clone)] pub enum WatchEventType { Touched, Changed, diff --git a/src/exec.rs b/src/exec.rs index 6d8aca4..6957c84 100644 --- a/src/exec.rs +++ b/src/exec.rs @@ -16,9 +16,8 @@ use std::time::Duration; use std::process::{Command, Stdio}; -use traits::Process; use error::CommandError; - +use traits::Process; fn env_var_to_tuple(var: &str) -> (String, String) { let mut vs = var.split('='); @@ -26,13 +25,16 @@ fn env_var_to_tuple(var: &str) -> (String, String) { return match vs.next() { Some(val) => (String::from(name), String::from(val)), None => (String::from(name), "".to_string()), - } + }; } ("".to_string(), "".to_string()) } pub fn run_cmd(cmd: &str, env: &Option>) -> Result { - let args = cmd.split(' ').filter(|s| !s.is_empty()).collect::>(); + let args = cmd + .split(' ') + .filter(|s| !s.is_empty()) + .collect::>(); if args.len() < 1 { return Err(CommandError::new("Empty command string passed in")); } @@ -55,7 +57,7 @@ pub fn run_cmd(cmd: &str, env: &Option>) -> Result }, // TODO(jeremy): We should not swallow this error. Err(_) => Err(CommandError::new("Error running command")), - } + }; } fn is_cmd_success(cmd: &str, env: Option>) -> bool { @@ -74,11 +76,13 @@ pub struct ExecProcess<'a> { } impl<'a> ExecProcess<'a> { - pub fn new(test_cmd: &'a str, - cmd: &'a str, - negate: bool, - env: Option>, - poll: Duration) -> ExecProcess<'a> { + pub fn new( + test_cmd: &'a str, + cmd: &'a str, + negate: bool, + env: Option>, + poll: Duration, + ) -> ExecProcess<'a> { ExecProcess { test_cmd: test_cmd, negate: negate, diff --git a/src/timer.rs b/src/timer.rs index 1163e8d..8fcec69 100644 --- a/src/timer.rs +++ b/src/timer.rs @@ -14,9 +14,9 @@ use std::thread; use std::time::Duration; -use traits::Process; use error::CommandError; use exec::run_cmd; +use traits::Process; pub struct TimerProcess<'a> { cmd: &'a str, @@ -26,10 +26,12 @@ pub struct TimerProcess<'a> { } impl<'a> TimerProcess<'a> { - pub fn new(cmd: &'a str, - env: Option>, - poll_duration: Duration, - max_repeat: Option) -> TimerProcess<'a> { + pub fn new( + cmd: &'a str, + env: Option>, + poll_duration: Duration, + max_repeat: Option, + ) -> TimerProcess<'a> { TimerProcess { cmd: cmd, env: env,