aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_vfs/src
diff options
context:
space:
mode:
authorBernardo <[email protected]>2019-01-25 21:13:55 +0000
committerAleksey Kladov <[email protected]>2019-01-26 08:46:37 +0000
commit410a3ae6e847b59f9930ce4d6bf9f3c5f1d72167 (patch)
tree5717d124c71de13412f61a8584b119da378828ae /crates/ra_vfs/src
parentd63e1cebff771621b90bdce25ac013eecb415e1e (diff)
use entry file_type, improve test
Diffstat (limited to 'crates/ra_vfs/src')
-rw-r--r--crates/ra_vfs/src/io/watcher.rs6
-rw-r--r--crates/ra_vfs/src/lib.rs3
2 files changed, 5 insertions, 4 deletions
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 {
65 { 65 {
66 match res { 66 match res {
67 Ok(entry) => { 67 Ok(entry) => {
68 if entry.path().is_dir() { 68 if entry.file_type().is_dir() {
69 watch_one(self.watcher.as_ref(), entry.path()); 69 watch_one(self.watcher.as_ref(), entry.path());
70 } 70 }
71 } 71 }
@@ -172,11 +172,11 @@ impl WatcherWorker {
172 let filter = &self.roots[root]; 172 let filter = &self.roots[root];
173 for res in WalkDir::new(dir) 173 for res in WalkDir::new(dir)
174 .into_iter() 174 .into_iter()
175 .filter_entry(|entry| filter.can_contain(entry.path()).is_some()) 175 .filter_entry(filter.entry_filter())
176 { 176 {
177 match res { 177 match res {
178 Ok(entry) => { 178 Ok(entry) => {
179 if entry.path().is_dir() { 179 if entry.file_type().is_dir() {
180 watch_one(self.watcher.as_ref(), entry.path()); 180 watch_one(self.watcher.as_ref(), entry.path());
181 } else { 181 } else {
182 // emit only for files otherwise we will cause watch_recursive to be called again with a dir that we are already watching 182 // 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 {
62 62
63 pub(crate) fn entry_filter<'a>(&'a self) -> impl FnMut(&DirEntry) -> bool + 'a { 63 pub(crate) fn entry_filter<'a>(&'a self) -> impl FnMut(&DirEntry) -> bool + 'a {
64 move |entry: &DirEntry| { 64 move |entry: &DirEntry| {
65 if entry.path().is_dir() && self.excluded_dirs.iter().any(|it| it == entry.path()) { 65 if entry.file_type().is_dir() && self.excluded_dirs.iter().any(|it| it == entry.path())
66 {
66 // do not walk nested roots 67 // do not walk nested roots
67 false 68 false
68 } else { 69 } else {