From 410a3ae6e847b59f9930ce4d6bf9f3c5f1d72167 Mon Sep 17 00:00:00 2001 From: Bernardo Date: Fri, 25 Jan 2019 22:13:55 +0100 Subject: use entry file_type, improve test --- crates/ra_vfs/src/io/watcher.rs | 6 +++--- crates/ra_vfs/src/lib.rs | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'crates/ra_vfs/src') diff --git a/crates/ra_vfs/src/io/watcher.rs b/crates/ra_vfs/src/io/watcher.rs index 1d7ce2136..ff6775f59 100644 --- a/crates/ra_vfs/src/io/watcher.rs +++ b/crates/ra_vfs/src/io/watcher.rs @@ -65,7 +65,7 @@ impl Watcher { { match res { Ok(entry) => { - if entry.path().is_dir() { + if entry.file_type().is_dir() { watch_one(self.watcher.as_ref(), entry.path()); } } @@ -172,11 +172,11 @@ impl WatcherWorker { let filter = &self.roots[root]; for res in WalkDir::new(dir) .into_iter() - .filter_entry(|entry| filter.can_contain(entry.path()).is_some()) + .filter_entry(filter.entry_filter()) { match res { Ok(entry) => { - if entry.path().is_dir() { + if entry.file_type().is_dir() { watch_one(self.watcher.as_ref(), entry.path()); } else { // emit only for files otherwise we will cause watch_recursive to be called again with a dir that we are already watching diff --git a/crates/ra_vfs/src/lib.rs b/crates/ra_vfs/src/lib.rs index 661892f8a..d1b0222e7 100644 --- a/crates/ra_vfs/src/lib.rs +++ b/crates/ra_vfs/src/lib.rs @@ -62,7 +62,8 @@ impl RootFilter { pub(crate) fn entry_filter<'a>(&'a self) -> impl FnMut(&DirEntry) -> bool + 'a { move |entry: &DirEntry| { - if entry.path().is_dir() && self.excluded_dirs.iter().any(|it| it == entry.path()) { + if entry.file_type().is_dir() && self.excluded_dirs.iter().any(|it| it == entry.path()) + { // do not walk nested roots false } else { -- cgit v1.2.3