Store paths as strings on PathMatch structs

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2021-04-21 12:05:34 -07:00
parent 955268e2a6
commit 8e0ca2056e
2 changed files with 6 additions and 9 deletions

View file

@ -45,9 +45,9 @@ impl PathEntry {
pub struct PathMatch {
pub score: f64,
pub positions: Vec<usize>,
pub path: String,
pub tree_id: usize,
pub entry_id: u64,
pub include_root: bool,
}
impl PartialEq for PathMatch {
@ -234,9 +234,9 @@ fn match_single_tree_paths<'a>(
results.push(Reverse(PathMatch {
tree_id,
entry_id: path_entry.ino,
path: path_entry.path.iter().skip(skipped_prefix_len).collect(),
score,
positions: match_positions.clone(),
include_root: skipped_prefix_len == 0,
}));
if results.len() == max_results {
*min_score = results.peek().unwrap().0.score;