From 51e2b0d0330b264972422d44ca25affcced981d5 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 13 Dec 2022 17:22:24 +0100 Subject: [PATCH] thanks clippy --- src/core/dir_entry.rs | 14 ++++++-------- src/lib.rs | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/core/dir_entry.rs b/src/core/dir_entry.rs index dc309b5..20a8ee8 100644 --- a/src/core/dir_entry.rs +++ b/src/core/dir_entry.rs @@ -79,13 +79,13 @@ impl DirEntry { follow_link_ancestors: Arc>>, ) -> Result { let metadata = if follow_link { - fs::metadata(&path).map_err(|err| Error::from_path(depth, path.to_owned(), err))? + fs::metadata(path).map_err(|err| Error::from_path(depth, path.to_owned(), err))? } else { - fs::symlink_metadata(&path) + fs::symlink_metadata(path) .map_err(|err| Error::from_path(depth, path.to_owned(), err))? }; - let root_name = path.file_name().unwrap_or_else(|| path.as_os_str()); + let root_name = path.file_name().unwrap_or(path.as_os_str()); let read_children_path: Option> = if metadata.file_type().is_dir() { Some(Arc::from(path)) @@ -196,16 +196,14 @@ impl DirEntry { &self, client_read_state: C::ReadDirState, ) -> Option> { - if let Some(read_children_path) = self.read_children_path.as_ref() { - Some(ReadDirSpec { + self.read_children_path + .as_ref() + .map(|read_children_path| ReadDirSpec { depth: self.depth, client_read_state, path: read_children_path.clone(), follow_link_ancestors: self.follow_link_ancestors.clone(), }) - } else { - None - } } pub(crate) fn follow_symlink(&self) -> Result { diff --git a/src/lib.rs b/src/lib.rs index 2b07bee..8ebd58c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -392,7 +392,7 @@ impl IntoIterator for WalkDirGeneric { root_entry_results, parallelism, min_depth, - root_read_dir_state.clone(), + root_read_dir_state, Arc::new(move |read_dir_spec| { let ReadDirSpec { path, @@ -487,7 +487,7 @@ impl Clone for WalkDirOptions { impl Parallelism { pub(crate) fn install(&self, op: OP) where - OP: FnOnce() -> () + Send + 'static, + OP: FnOnce() + Send + 'static, { match self { Parallelism::Serial => op(),