From 1f462ca1dc57865407528617ea06c7912ddf59e0 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Mon, 30 Oct 2023 10:15:36 +0900 Subject: [PATCH] rewrite: replace use of "lift"ed function application with try_collect() Also removed redundant borrow + clone. --- lib/src/rewrite.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/src/rewrite.rs b/lib/src/rewrite.rs index d1d489b33c..398b534791 100644 --- a/lib/src/rewrite.rs +++ b/lib/src/rewrite.rs @@ -17,7 +17,7 @@ use std::collections::{HashMap, HashSet}; use std::sync::Arc; -use itertools::{process_results, Itertools}; +use itertools::Itertools; use tracing::instrument; use crate::backend::{BackendError, CommitId, ObjectId}; @@ -401,16 +401,13 @@ impl<'settings, 'repo> DescendantRebaser<'settings, 'repo> { .mut_repo .index() .heads(&mut new_parent_ids.iter()) - .iter() - .cloned() + .into_iter() .collect(); - let new_parents = process_results( - new_parent_ids - .iter() - .filter(|new_parent| head_set.contains(new_parent)) - .map(|new_parent_id| self.mut_repo.store().get_commit(new_parent_id)), - |iter| iter.collect_vec(), - )?; + let new_parents: Vec<_> = new_parent_ids + .iter() + .filter(|new_parent| head_set.contains(new_parent)) + .map(|new_parent_id| self.mut_repo.store().get_commit(new_parent_id)) + .try_collect()?; let new_commit = rebase_commit(self.settings, self.mut_repo, &old_commit, &new_parents)?; self.rebased