diff -r ef8dcee272ac -r 26114bd6ec60 rust/hg-core/src/dagops.rs --- a/rust/hg-core/src/dagops.rs Mon Jun 15 15:14:16 2020 -0400 +++ b/rust/hg-core/src/dagops.rs Mon Jun 15 18:26:40 2020 +0200 @@ -16,10 +16,10 @@ use crate::ancestors::AncestorsIterator; use std::collections::{BTreeSet, HashSet}; -fn remove_parents( +fn remove_parents( graph: &impl Graph, rev: Revision, - set: &mut HashSet, + set: &mut HashSet, ) -> Result<(), GraphError> { for parent in graph.parents(rev)?.iter() { if *parent != NULL_REVISION { @@ -65,9 +65,9 @@ /// /// # Performance notes /// Internally, this function will store a full copy of `revs` in a `Vec`. -pub fn retain_heads( +pub fn retain_heads( graph: &impl Graph, - revs: &mut HashSet, + revs: &mut HashSet, ) -> Result<(), GraphError> { revs.remove(&NULL_REVISION); // we need to construct an iterable copy of revs to avoid itering while @@ -84,9 +84,9 @@ /// Roots of `revs`, passed as a `HashSet` /// /// They are returned in arbitrary order -pub fn roots( +pub fn roots( graph: &G, - revs: &HashSet, + revs: &HashSet, ) -> Result, GraphError> { let mut roots: Vec = Vec::new(); for rev in revs { @@ -229,7 +229,8 @@ graph: &impl Graph, revs: &[Revision], ) -> Result, GraphError> { - let mut as_vec = roots(graph, &revs.iter().cloned().collect())?; + let set: HashSet<_> = revs.iter().cloned().collect(); + let mut as_vec = roots(graph, &set)?; as_vec.sort(); Ok(as_vec) }