diff --git a/crates/memofs/src/in_memory_fs.rs b/crates/memofs/src/in_memory_fs.rs index 328fbffe..fc8cf2ef 100644 --- a/crates/memofs/src/in_memory_fs.rs +++ b/crates/memofs/src/in_memory_fs.rs @@ -50,6 +50,12 @@ impl InMemoryFs { } } +impl Default for InMemoryFs { + fn default() -> Self { + Self::new() + } +} + #[derive(Debug)] struct InMemoryFsInner { entries: HashMap, diff --git a/crates/memofs/src/lib.rs b/crates/memofs/src/lib.rs index f6a17ef6..744ca60f 100644 --- a/crates/memofs/src/lib.rs +++ b/crates/memofs/src/lib.rs @@ -194,11 +194,8 @@ impl VfsInner { } fn commit_event(&mut self, event: &VfsEvent) -> io::Result<()> { - match event { - VfsEvent::Remove(path) => { - let _ = self.backend.unwatch(&path); - } - _ => {} + if let VfsEvent::Remove(path) = event { + let _ = self.backend.unwatch(path); } Ok(()) diff --git a/crates/memofs/src/noop_backend.rs b/crates/memofs/src/noop_backend.rs index 383119c5..efc8fd4a 100644 --- a/crates/memofs/src/noop_backend.rs +++ b/crates/memofs/src/noop_backend.rs @@ -74,3 +74,9 @@ impl VfsBackend for NoopBackend { )) } } + +impl Default for NoopBackend { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/memofs/src/std_backend.rs b/crates/memofs/src/std_backend.rs index 7e616cbd..c13ade0b 100644 --- a/crates/memofs/src/std_backend.rs +++ b/crates/memofs/src/std_backend.rs @@ -108,3 +108,9 @@ impl VfsBackend for StdBackend { .map_err(|inner| io::Error::new(io::ErrorKind::Other, inner)) } } + +impl Default for StdBackend { + fn default() -> Self { + Self::new() + } +}