Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/vfs-notify/src/lib.rs')
-rw-r--r--crates/vfs-notify/src/lib.rs85
1 files changed, 41 insertions, 44 deletions
diff --git a/crates/vfs-notify/src/lib.rs b/crates/vfs-notify/src/lib.rs
index a03337dbc5..c6393cc692 100644
--- a/crates/vfs-notify/src/lib.rs
+++ b/crates/vfs-notify/src/lib.rs
@@ -194,52 +194,49 @@ impl NotifyActor {
}
},
Event::NotifyEvent(event) => {
- if let Some(event) = log_notify_error(event) {
- if let EventKind::Create(_) | EventKind::Modify(_) | EventKind::Remove(_) =
+ if let Some(event) = log_notify_error(event)
+ && let EventKind::Create(_) | EventKind::Modify(_) | EventKind::Remove(_) =
event.kind
- {
- let files = event
- .paths
- .into_iter()
- .filter_map(|path| {
- Some(
- AbsPathBuf::try_from(
- Utf8PathBuf::from_path_buf(path).ok()?,
- )
+ {
+ let files = event
+ .paths
+ .into_iter()
+ .filter_map(|path| {
+ Some(
+ AbsPathBuf::try_from(Utf8PathBuf::from_path_buf(path).ok()?)
.expect("path is absolute"),
- )
- })
- .filter_map(|path| -> Option<(AbsPathBuf, Option<Vec<u8>>)> {
- let meta = fs::metadata(&path).ok()?;
- if meta.file_type().is_dir()
- && self
- .watched_dir_entries
- .iter()
- .any(|dir| dir.contains_dir(&path))
- {
- self.watch(path.as_ref());
- return None;
- }
-
- if !meta.file_type().is_file() {
- return None;
- }
-
- if !(self.watched_file_entries.contains(&path)
- || self
- .watched_dir_entries
- .iter()
- .any(|dir| dir.contains_file(&path)))
- {
- return None;
- }
-
- let contents = read(&path);
- Some((path, contents))
- })
- .collect();
- self.send(loader::Message::Changed { files });
- }
+ )
+ })
+ .filter_map(|path| -> Option<(AbsPathBuf, Option<Vec<u8>>)> {
+ let meta = fs::metadata(&path).ok()?;
+ if meta.file_type().is_dir()
+ && self
+ .watched_dir_entries
+ .iter()
+ .any(|dir| dir.contains_dir(&path))
+ {
+ self.watch(path.as_ref());
+ return None;
+ }
+
+ if !meta.file_type().is_file() {
+ return None;
+ }
+
+ if !(self.watched_file_entries.contains(&path)
+ || self
+ .watched_dir_entries
+ .iter()
+ .any(|dir| dir.contains_file(&path)))
+ {
+ return None;
+ }
+
+ let contents = read(&path);
+ Some((path, contents))
+ })
+ .collect();
+ self.send(loader::Message::Changed { files });
}
}
}