diff --git a/src/cli.rs b/src/cli.rs index 353d28b..3e9e906 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -46,12 +46,12 @@ pub fn get_args() -> Args { .long("exts") .takes_value(true)) .arg(Arg::with_name("path") - .help("Watch a specific directory") - .short("w") - .long("watch") - .number_of_values(1) - .multiple(true) - .takes_value(true)) + .help("Watch a specific directory") + .short("w") + .long("watch") + .number_of_values(1) + .multiple(true) + .takes_value(true)) .arg(Arg::with_name("clear") .help("Clear screen before executing command") .short("c") diff --git a/src/gitignore.rs b/src/gitignore.rs index 61536ec..35de420 100644 --- a/src/gitignore.rs +++ b/src/gitignore.rs @@ -41,7 +41,7 @@ enum MatchResult { None, } -pub fn load(paths: &Vec) -> Gitignore { +pub fn load(paths: &[PathBuf]) -> Gitignore { let mut files = vec![]; let mut checked_dirs = HashSet::new(); diff --git a/src/main.rs b/src/main.rs index 2262860..2690062 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,16 +80,18 @@ fn main() { let paths: Vec = args.paths .iter() - .map(|p| Path::new(&p) - .canonicalize() - .expect(&format!("unable to canonicalize \"{}\"", &p)) - .to_owned()) + .map(|p| { + Path::new(&p) + .canonicalize() + .expect(&format!("unable to canonicalize \"{}\"", &p)) + .to_owned() + }) .collect(); let gitignore = if !args.no_vcs_ignore { gitignore::load(&paths) } else { - gitignore::load(&vec![]) + gitignore::load(&[]) }; let filter = NotificationFilter::new(args.filters, args.ignores, gitignore) diff --git a/src/watcher.rs b/src/watcher.rs index c39b8f6..2cae95a 100644 --- a/src/watcher.rs +++ b/src/watcher.rs @@ -22,12 +22,16 @@ enum WatcherImpl { } impl Watcher { - pub fn new(tx: Sender, paths: &Vec, poll: bool, interval_ms: u32) -> Result { + pub fn new(tx: Sender, + paths: &[PathBuf], + poll: bool, + interval_ms: u32) + -> Result { use notify::Watcher; let imp = if poll { let mut watcher = try!(PollWatcher::with_delay_ms(tx, interval_ms)); - for ref path in paths { + for path in paths { try!(watcher.watch(path, RecursiveMode::Recursive)); debug!("Watching {:?}", path); } @@ -35,7 +39,7 @@ impl Watcher { WatcherImpl::Poll(watcher) } else { let mut watcher = try!(raw_watcher(tx)); - for ref path in paths { + for path in paths { try!(watcher.watch(path, RecursiveMode::Recursive)); debug!("Watching {:?}", path); }