mirror of
https://github.com/watchexec/watchexec.git
synced 2024-09-28 22:21:33 +02:00
rustfmt & clippy fixes
This commit is contained in:
parent
e16a6b3a24
commit
125e7eb7c8
@ -41,7 +41,7 @@ enum MatchResult {
|
||||
None,
|
||||
}
|
||||
|
||||
pub fn load(paths: &Vec<PathBuf>) -> Gitignore {
|
||||
pub fn load(paths: &[PathBuf]) -> Gitignore {
|
||||
let mut files = vec![];
|
||||
let mut checked_dirs = HashSet::new();
|
||||
|
||||
|
@ -80,16 +80,18 @@ fn main() {
|
||||
|
||||
let paths: Vec<PathBuf> = args.paths
|
||||
.iter()
|
||||
.map(|p| Path::new(&p)
|
||||
.map(|p| {
|
||||
Path::new(&p)
|
||||
.canonicalize()
|
||||
.expect(&format!("unable to canonicalize \"{}\"", &p))
|
||||
.to_owned())
|
||||
.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)
|
||||
|
@ -22,12 +22,16 @@ enum WatcherImpl {
|
||||
}
|
||||
|
||||
impl Watcher {
|
||||
pub fn new(tx: Sender<Event>, paths: &Vec<PathBuf>, poll: bool, interval_ms: u32) -> Result<Watcher, Error> {
|
||||
pub fn new(tx: Sender<Event>,
|
||||
paths: &[PathBuf],
|
||||
poll: bool,
|
||||
interval_ms: u32)
|
||||
-> Result<Watcher, Error> {
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user