annotate: remove unneeded BString<->Vec round-trip
Some checks are pending
binaries / Build binary artifacts (push) Waiting to run
nix / flake check (push) Waiting to run
build / build (, macos-13) (push) Waiting to run
build / build (, macos-14) (push) Waiting to run
build / build (, ubuntu-latest) (push) Waiting to run
build / build (, windows-latest) (push) Waiting to run
build / build (--all-features, ubuntu-latest) (push) Waiting to run
build / Build jj-lib without Git support (push) Waiting to run
build / Check protos (push) Waiting to run
build / Check formatting (push) Waiting to run
build / Check that MkDocs can build the docs (push) Waiting to run
build / Check that MkDocs can build the docs with latest Python and uv (push) Waiting to run
build / cargo-deny (advisories) (push) Waiting to run
build / cargo-deny (bans licenses sources) (push) Waiting to run
build / Clippy check (push) Waiting to run
Codespell / Codespell (push) Waiting to run
website / prerelease-docs-build-deploy (ubuntu-latest) (push) Waiting to run
Scorecards supply-chain security / Scorecards analysis (push) Waiting to run

This commit is contained in:
Yuya Nishihara 2024-11-20 20:55:13 +09:00
parent 59a79fdcc0
commit 7906b3f4a5

View file

@ -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) {
@ -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 {
@ -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()),
}
}