From 0dabd8a1f6361c4d76178d96097ead0bb5852e5e Mon Sep 17 00:00:00 2001 From: Kenneth Loeffler Date: Fri, 30 Jun 2023 11:04:04 -0700 Subject: [PATCH] Fix memofs clippy lints (#682) The third in a series of PRs that aim to get CI passing --- crates/memofs/src/in_memory_fs.rs | 6 ++++++ crates/memofs/src/lib.rs | 7 ++----- crates/memofs/src/noop_backend.rs | 6 ++++++ crates/memofs/src/std_backend.rs | 6 ++++++ 4 files changed, 20 insertions(+), 5 deletions(-) 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() + } +}