From f9a3021a7ac5ff685c5fc7dc492100c2c09f4bad Mon Sep 17 00:00:00 2001 From: Evan Mesterhazy Date: Sun, 21 Apr 2024 10:33:36 -0400 Subject: [PATCH] Simplify calls to `CommitRewriter::replace_parents()` Now that it takes `IntoIterator` the caller doesn't need to clone the input `CommitIds`. --- cli/src/commands/split.rs | 6 ++---- lib/tests/test_rewrite_transform.rs | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cli/src/commands/split.rs b/cli/src/commands/split.rs index c4298d23a..38514f04e 100644 --- a/cli/src/commands/split.rs +++ b/cli/src/commands/split.rs @@ -181,10 +181,8 @@ the operation will be aborted. |mut rewriter| { num_rebased += 1; if args.siblings { - rewriter.replace_parent( - second_commit.id(), - &[first_commit.id().clone(), second_commit.id().clone()], - ); + rewriter + .replace_parent(second_commit.id(), [first_commit.id(), second_commit.id()]); } // We don't need to do anything special for the non-siblings case // since we already marked the original commit as rewritten. diff --git a/lib/tests/test_rewrite_transform.rs b/lib/tests/test_rewrite_transform.rs index 2a7c804b8..58ebc7e76 100644 --- a/lib/tests/test_rewrite_transform.rs +++ b/lib/tests/test_rewrite_transform.rs @@ -48,7 +48,7 @@ fn test_transform_descendants_sync() { let mut rebased = HashMap::new(); tx.mut_repo() .transform_descendants(&settings, vec![commit_b.id().clone()], |mut rewriter| { - rewriter.replace_parent(commit_a.id(), &[commit_g.id().clone()]); + rewriter.replace_parent(commit_a.id(), [commit_g.id()]); if *rewriter.old_commit() == commit_c { let old_id = rewriter.old_commit().id().clone(); let new_parent_ids = rewriter.new_parents().to_vec(); @@ -106,7 +106,7 @@ fn test_transform_descendants_sync_linearize_merge() { let mut rebased = HashMap::new(); tx.mut_repo() .transform_descendants(&settings, vec![commit_c.id().clone()], |mut rewriter| { - rewriter.replace_parent(commit_a.id(), &[commit_b.id().clone()]); + rewriter.replace_parent(commit_a.id(), [commit_b.id()]); let old_commit_id = rewriter.old_commit().id().clone(); let new_commit = rewriter.rebase(&settings)?.write()?; rebased.insert(old_commit_id, new_commit);