Remove unnescessary double lookup

This commit is contained in:
Mikayla Maki 2023-05-19 11:08:58 -07:00
parent 3984cc6d39
commit 6792788216
No known key found for this signature in database

View File

@ -125,7 +125,7 @@ impl Snapshot {
let mut max_len = 0;
let mut current_candidate = None;
for (work_directory, repo) in (&self.repository_entries).iter() {
if repo.contains(self, path) {
if path.starts_with(&work_directory.0) {
if work_directory.0.as_os_str().len() >= max_len {
current_candidate = Some(repo);
max_len = work_directory.0.as_os_str().len();