diff options
Diffstat (limited to 'tvix/castore/src/import.rs')
-rw-r--r-- | tvix/castore/src/import.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/tvix/castore/src/import.rs b/tvix/castore/src/import.rs index a7034af19f5c..f78029ee0e3a 100644 --- a/tvix/castore/src/import.rs +++ b/tvix/castore/src/import.rs @@ -284,14 +284,8 @@ impl MerkleInvariantChecker { } /// Returns a potential ancestor already seen for that directory entry. - fn find_ancestor(&self, node: &DirEntry) -> Option<PathBuf> { - for anc in node.path().ancestors() { - if self.seen.contains(anc) { - return Some(anc.to_owned()); - } - } - - None + fn find_ancestor<'a>(&self, node: &'a DirEntry) -> Option<&'a Path> { + node.path().ancestors().find(|p| self.seen.contains(*p)) } } |