Avoid unwrap in file finder (#18374)
Release Notes: - Fixed a (rare) panic in file finder --------- Co-authored-by: Kirill Bulatov <kirill@zed.dev>
This commit is contained in:
parent
6167688a63
commit
b701eab44f
1 changed files with 16 additions and 12 deletions
|
@ -394,7 +394,7 @@ fn matching_history_items<'a>(
|
||||||
.chars(),
|
.chars(),
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
candidates_paths.insert(Arc::clone(&found_path.project.path), found_path);
|
candidates_paths.insert(&found_path.project, found_path);
|
||||||
Some((found_path.project.worktree_id, candidate))
|
Some((found_path.project.worktree_id, candidate))
|
||||||
})
|
})
|
||||||
.fold(
|
.fold(
|
||||||
|
@ -419,17 +419,21 @@ fn matching_history_items<'a>(
|
||||||
max_results,
|
max_results,
|
||||||
)
|
)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|path_match| {
|
.filter_map(|path_match| {
|
||||||
let (_, found_path) = candidates_paths
|
candidates_paths
|
||||||
.remove_entry(&path_match.path)
|
.remove_entry(&ProjectPath {
|
||||||
.expect("candidate info not found");
|
worktree_id: WorktreeId::from_usize(path_match.worktree_id),
|
||||||
(
|
path: Arc::clone(&path_match.path),
|
||||||
Arc::clone(&path_match.path),
|
})
|
||||||
Match::History {
|
.map(|(_, found_path)| {
|
||||||
path: found_path.clone(),
|
(
|
||||||
panel_match: Some(ProjectPanelOrdMatch(path_match)),
|
Arc::clone(&path_match.path),
|
||||||
},
|
Match::History {
|
||||||
)
|
path: found_path.clone(),
|
||||||
|
panel_match: Some(ProjectPanelOrdMatch(path_match)),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
})
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue