diff --git a/lib/src/dag_walk.rs b/lib/src/dag_walk.rs index e333832e0..582608b7f 100644 --- a/lib/src/dag_walk.rs +++ b/lib/src/dag_walk.rs @@ -110,8 +110,8 @@ where pub fn leaves( start: II, - neighbors_fn: &mut impl FnMut(&T) -> NI, - id_fn: &impl Fn(&T) -> ID, + mut neighbors_fn: impl FnMut(&T) -> NI, + id_fn: impl Fn(&T) -> ID, ) -> HashSet where T: Hash + Eq + Clone, @@ -147,8 +147,8 @@ where /// start set. pub fn heads( start: II, - neighbors_fn: &impl Fn(&T) -> NI, - id_fn: &impl Fn(&T) -> ID, + neighbors_fn: impl Fn(&T) -> NI, + id_fn: impl Fn(&T) -> ID, ) -> HashSet where T: Hash + Eq + Clone, @@ -175,8 +175,8 @@ where pub fn closest_common_node( set1: II1, set2: II2, - neighbors_fn: &impl Fn(&T) -> NI, - id_fn: &impl Fn(&T) -> ID, + neighbors_fn: impl Fn(&T) -> NI, + id_fn: impl Fn(&T) -> ID, ) -> Option where T: Hash + Eq + Clone, @@ -341,8 +341,8 @@ mod tests { let common = closest_common_node( vec!['E'], vec!['H'], - &|node| neighbors[node].clone(), - &|node| *node, + |node| neighbors[node].clone(), + |node| *node, ); // TODO: fix the implementation to return B @@ -372,16 +372,16 @@ mod tests { let actual = heads( vec!['A', 'C', 'D', 'F'], - &|node| neighbors[node].clone(), - &|node| *node, + |node| neighbors[node].clone(), + |node| *node, ); assert_eq!(actual, hashset!['D', 'F']); // Check with a different order in the start set let actual = heads( vec!['F', 'D', 'C', 'A'], - &|node| neighbors[node].clone(), - &|node| *node, + |node| neighbors[node].clone(), + |node| *node, ); assert_eq!(actual, hashset!['D', 'F']); } diff --git a/lib/src/op_heads_store.rs b/lib/src/op_heads_store.rs index 7a88a8498..9a5f486bd 100644 --- a/lib/src/op_heads_store.rs +++ b/lib/src/op_heads_store.rs @@ -55,7 +55,7 @@ pub trait OpHeadsStore: Send + Sync + Debug { let neighbors_fn = |op: &Operation| op.parents(); // Remove ancestors so we don't create merge operation with an operation and its // ancestor - let op_heads = dag_walk::heads(op_heads, &neighbors_fn, &|op: &Operation| op.id().clone()); + let op_heads = dag_walk::heads(op_heads, neighbors_fn, |op: &Operation| op.id().clone()); let op_head_ids_after: HashSet<_> = op_heads.iter().map(|op| op.id().clone()).collect(); for removed_op_head in op_head_ids_before.difference(&op_head_ids_after) { self.remove_op_head(removed_op_head); diff --git a/lib/src/transaction.rs b/lib/src/transaction.rs index d14b80257..685362a99 100644 --- a/lib/src/transaction.rs +++ b/lib/src/transaction.rs @@ -68,8 +68,8 @@ impl Transaction { let ancestor_op = closest_common_node( self.parent_ops.clone(), vec![other_op.clone()], - &|op: &Operation| op.parents(), - &|op: &Operation| op.id().clone(), + |op: &Operation| op.parents(), + |op: &Operation| op.id().clone(), ) .unwrap(); let repo_loader = self.base_repo().loader(); diff --git a/src/cli_util.rs b/src/cli_util.rs index 461216330..68f0c6532 100644 --- a/src/cli_util.rs +++ b/src/cli_util.rs @@ -1457,8 +1457,8 @@ pub fn check_stale_working_copy( let maybe_ancestor_op = dag_walk::closest_common_node( [wc_operation.clone()], [repo_operation.clone()], - &|op: &Operation| op.parents(), - &|op: &Operation| op.id().clone(), + |op: &Operation| op.parents(), + |op: &Operation| op.id().clone(), ); if let Some(ancestor_op) = maybe_ancestor_op { if ancestor_op.id() == repo_operation.id() {