Explorar o código

refactor: flip if (as suggested/demanded by clippy)

Signed-off-by: sbatial <mail@kbode.com>
sbatial %!s(int64=2) %!d(string=hai) anos
pai
achega
1e21787b47
Modificáronse 1 ficheiros con 6 adicións e 6 borrados
  1. 6 6
      src/fs/file.rs

+ 6 - 6
src/fs/file.rs

@@ -433,14 +433,14 @@ impl<'dir> File<'dir> {
     // make it difficult to get any info about a dir by it's size, so this may be it.
     // make it difficult to get any info about a dir by it's size, so this may be it.
     #[cfg(unix)]
     #[cfg(unix)]
     pub fn is_empty_dir(&self) -> bool {
     pub fn is_empty_dir(&self) -> bool {
-        if !self.is_directory() {
-            false
-        } else {
+        if self.is_directory() {
             match Dir::read_dir(self.path.clone()) {
             match Dir::read_dir(self.path.clone()) {
-         // . & .. are skipped, if the returned iterator has .next(), it's not empty
-                Ok(has_files) =>  has_files.files(super::DotFilter::Dotfiles, None, false, false).next().is_none(),
+                // . & .. are skipped, if the returned iterator has .next(), it's not empty
+                Ok(has_files) => has_files.files(super::DotFilter::Dotfiles, None, false, false).next().is_none(),
                 Err(_) => false,
                 Err(_) => false,
-                }
+            }
+        } else {
+            false
         }
         }
     }
     }