Patchwork D8957: hg-core: fix some clippy warnings

login
register
mail settings
Submitter phabricator
Date Aug. 26, 2020, 1:23 p.m.
Message ID <differential-rev-PHID-DREV-butno6tobxqnx5gpv2dp-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47055/
State Superseded
Headers show

Comments

phabricator - Aug. 26, 2020, 1:23 p.m.
acezar created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8957

AFFECTED FILES
  rust/hg-core/src/operations/find_root.rs

CHANGE DETAILS




To: acezar, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/operations/find_root.rs b/rust/hg-core/src/operations/find_root.rs
--- a/rust/hg-core/src/operations/find_root.rs
+++ b/rust/hg-core/src/operations/find_root.rs
@@ -56,10 +56,10 @@ 
         };
 
         if current_dir.join(".hg").exists() {
-            return Ok(current_dir.into());
+            return Ok(current_dir);
         }
-        let mut ancestors = current_dir.ancestors();
-        while let Some(parent) = ancestors.next() {
+        let ancestors = current_dir.ancestors();
+        for parent in ancestors {
             if parent.join(".hg").exists() {
                 return Ok(parent.into());
             }