aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_vfs/src/io/watcher.rs
diff options
context:
space:
mode:
authorBernardo <[email protected]>2019-01-21 18:11:39 +0000
committerAleksey Kladov <[email protected]>2019-01-26 08:46:27 +0000
commit2a1afad3eda7d8c5635de6e7f524ed943cecc22b (patch)
tree111c1599e22596094247bfe1277031748de0e3f9 /crates/ra_vfs/src/io/watcher.rs
parent277e0f1baa21b8f3e5b040b78ce2bd6beca6cd7c (diff)
avoid boxing
Diffstat (limited to 'crates/ra_vfs/src/io/watcher.rs')
-rw-r--r--crates/ra_vfs/src/io/watcher.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/crates/ra_vfs/src/io/watcher.rs b/crates/ra_vfs/src/io/watcher.rs
index e33298477..5e9bc8ff3 100644
--- a/crates/ra_vfs/src/io/watcher.rs
+++ b/crates/ra_vfs/src/io/watcher.rs
@@ -1,4 +1,4 @@
1use crate::io; 1use crate::{io, RootFilter};
2use crossbeam_channel::Sender; 2use crossbeam_channel::Sender;
3use drop_bomb::DropBomb; 3use drop_bomb::DropBomb;
4use notify::{DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher as NotifyWatcher}; 4use notify::{DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher as NotifyWatcher};
@@ -8,7 +8,7 @@ use std::{
8 thread, 8 thread,
9 time::Duration, 9 time::Duration,
10}; 10};
11use walkdir::{DirEntry, WalkDir}; 11use walkdir::WalkDir;
12 12
13#[derive(Debug)] 13#[derive(Debug)]
14pub enum WatcherChange { 14pub enum WatcherChange {
@@ -83,13 +83,11 @@ impl Watcher {
83 }) 83 })
84 } 84 }
85 85
86 pub fn watch_recursive( 86 pub fn watch_recursive(&mut self, dir: &Path, filter: &RootFilter, emit_for_contents: bool) {
87 &mut self, 87 for res in WalkDir::new(dir)
88 dir: &Path, 88 .into_iter()
89 filter_entry: impl Fn(&DirEntry) -> bool, 89 .filter_entry(|entry| filter.can_contain(entry.path()).is_some())
90 emit_for_contents: bool, 90 {
91 ) {
92 for res in WalkDir::new(dir).into_iter().filter_entry(filter_entry) {
93 match res { 91 match res {
94 Ok(entry) => { 92 Ok(entry) => {
95 if entry.path().is_dir() { 93 if entry.path().is_dir() {