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()); }