Skip to content

Commit

Permalink
test_merged_tree: avoid a temporary lifetime extension
Browse files Browse the repository at this point in the history
I think it's just clearer to assign the owned value to the variable
than to assign a reference to a temporary value.
  • Loading branch information
martinvonz committed Nov 28, 2024
1 parent 409be2e commit a5690be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/tests/test_merged_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,11 @@ fn test_from_legacy_tree() {

// dir1: directory without conflicts
let dir1_basename = RepoPathComponent::new("dir1");
let dir1_filename = &RepoPath::root()
let dir1_filename = RepoPath::root()
.join(dir1_basename)
.join(RepoPathComponent::new("file"));
let dir1_filename_id = write_file(store.as_ref(), dir1_filename, "file5_v2");
tree_builder.set(dir1_filename.to_owned(), file_value(&dir1_filename_id));
let dir1_filename_id = write_file(store.as_ref(), &dir1_filename, "file5_v2");
tree_builder.set(dir1_filename.clone(), file_value(&dir1_filename_id));

let tree_id = tree_builder.write_tree().unwrap();
let tree = store.get_tree(RepoPathBuf::root(), &tree_id).unwrap();
Expand Down Expand Up @@ -269,7 +269,7 @@ fn test_from_legacy_tree() {
tree_builder.set_or_remove(file3_path.to_owned(), file3_conflict);
tree_builder.set_or_remove(file4_path.to_owned(), file4_conflict);
tree_builder.set_or_remove(
dir1_filename.to_owned(),
dir1_filename.clone(),
Merge::normal(file_value(&dir1_filename_id)),
);
let recreated_merged_id = tree_builder.write_tree(store).unwrap();
Expand Down

0 comments on commit a5690be

Please sign in to comment.