Ver Fonte

refactor(clippy): clippy::redundant_else

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
Christina Sørensen há 2 anos atrás
pai
commit
26d0ea645a
2 ficheiros alterados com 10 adições e 13 exclusões
  1. 8 10
      src/fs/feature/git.rs
  2. 2 3
      src/fs/file.rs

+ 8 - 10
src/fs/feature/git.rs

@@ -170,15 +170,13 @@ impl GitRepo {
                 if e.code() != git2::ErrorCode::NotFound {
                     error!("Error opening Git repo from env using GIT_DIR: {:?}", e);
                     return Err(path);
-                } else {
-                    // nothing found, search using discover
-                    match git2::Repository::discover(&path) {
-                        Ok(r) => r,
-                        Err(e) => {
-                            error!("Error discovering Git repositories: {:?}", e);
-                            return Err(path);
-
-                        }
+                }
+                // nothing found, search using discover
+                match git2::Repository::discover(&path) {
+                    Ok(r) => r,
+                    Err(e) => {
+                        error!("Error discovering Git repositories: {:?}", e);
+                        return Err(path);
                     }
                 }
             }
@@ -405,4 +403,4 @@ impl f::SubdirGitRepo{
         }
         Self::default()
     }
-}
+}

+ 2 - 3
src/fs/file.rs

@@ -316,10 +316,9 @@ impl<'dir> File<'dir> {
         if let FileTarget::Ok(f) = target {
             if f.is_link() {
                 return f.link_target_recurse();
-            } else {
-                return FileTarget::Ok(f);
             }
-        } 
+            return FileTarget::Ok(f);
+        }
         target
     }