diff options
author | Pi-Cla <pirateclip@protonmail.com> | 2024-03-31 13:22:46 -0600 |
---|---|---|
committer | Pi-Cla <pirateclip@protonmail.com> | 2024-03-31 13:22:46 -0600 |
commit | b2cbe0732d9216280f3566702c0af9b9a8040ddf (patch) | |
tree | ab259b1e7e14fee45f7c4da1868d3b69010a950e /src/lib.rs | |
parent | d2596815187df6d2f992362647539325640e50b2 (diff) |
Apply cargo clippy lints
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 15 |
1 files changed, 6 insertions, 9 deletions
@@ -39,7 +39,7 @@ pub fn run(config: &mut Config) -> Result<()> { } fn run_with_repo(config: &Config, repo: &git2::Repository) -> Result<()> { - let stack = stack::working_stack(&repo, config.base, config.force, config.logger)?; + let stack = stack::working_stack(repo, config.base, config.force, config.logger)?; if stack.is_empty() { crit!(config.logger, "No commits available to fix up, exiting"); return Ok(()); @@ -91,10 +91,7 @@ fn run_with_repo(config: &Config, repo: &git2::Repository) -> Result<()> { } let summary_counts = stack::summary_counts(&stack); - ( - stack.into_iter().zip(diffs.into_iter()).collect(), - summary_counts, - ) + (stack.into_iter().zip(diffs).collect(), summary_counts) }; let mut head_tree = repo.head()?.peel_to_tree()?; @@ -188,7 +185,7 @@ fn run_with_repo(config: &Config, repo: &git2::Repository) -> Result<()> { let mut commuted_old_path = old_path; let mut commuted_index_hunk = isolated_hunk; - 'commit: for &(ref commit, ref diff) in &stack { + 'commit: for (commit, diff) in &stack { let c_logger = config.logger.new(o!( "commit" => commit.id().to_string(), )); @@ -271,7 +268,7 @@ fn run_with_repo(config: &Config, repo: &git2::Repository) -> Result<()> { } } - let target_always_sha: bool = config::fixup_target_always_sha(&repo); + let target_always_sha: bool = config::fixup_target_always_sha(repo); hunks_with_commit.sort_by_key(|h| h.dest_commit.id()); // * apply all hunks that are going to be fixed up into `dest_commit` @@ -286,7 +283,7 @@ fn run_with_repo(config: &Config, repo: &git2::Repository) -> Result<()> { .zip(hunks_with_commit.iter().skip(1).map(Some).chain([None])) { let new_head_tree = apply_hunk_to_tree( - &repo, + repo, &head_tree, ¤t.hunk_to_apply, ¤t.index_patch.old_path, @@ -373,7 +370,7 @@ fn run_with_repo(config: &Config, repo: &git2::Repository) -> Result<()> { assert!(number_of_parents <= 1); let mut command = Command::new("git"); - command.args(&["rebase", "--interactive", "--autosquash", "--autostash"]); + command.args(["rebase", "--interactive", "--autosquash", "--autostash"]); if number_of_parents == 0 { command.arg("--root"); |