Skip to content

Commit

Permalink
annotate: remove unneeded BString<->Vec round-trip
Browse files Browse the repository at this point in the history
  • Loading branch information
yuja committed Nov 21, 2024
1 parent 59a79fd commit 7906b3f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/src/annotate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl Source {
fn load(commit: &Commit, file_path: &RepoPath) -> Result<Self, BackendError> {
let tree = commit.tree()?;
let text = get_file_contents(commit.store(), file_path, &tree)?;
Ok(Self::new(text.into()))
Ok(Self::new(text))
}

fn fill_line_map(&mut self) {
Expand Down Expand Up @@ -343,7 +343,7 @@ fn get_file_contents(
store: &Store,
path: &RepoPath,
tree: &MergedTree,
) -> Result<Vec<u8>, BackendError> {
) -> Result<BString, BackendError> {
let file_value = tree.path_value(path)?;
let effective_file_value = materialize_tree_value(store, path, file_value).block_on()?;
match effective_file_value {
Expand All @@ -356,12 +356,12 @@ fn get_file_contents(
id,
source: Box::new(e),
})?;
Ok(file_contents)
Ok(file_contents.into())
}
MaterializedTreeValue::FileConflict { contents, .. } => {
Ok(materialize_merge_result_to_bytes(&contents).into())
Ok(materialize_merge_result_to_bytes(&contents))
}
_ => Ok(Vec::new()),
_ => Ok(BString::default()),
}
}

Expand Down

0 comments on commit 7906b3f

Please sign in to comment.