Patchwork D7722: rust-discovery: simplifying add_missing_revisions()

login
register
mail settings
Submitter phabricator
Date Dec. 24, 2019, 1:50 p.m.
Message ID <differential-rev-PHID-DREV-w2d3bo6k2iavohuu6qlu-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44043/
State New
Headers show

Comments

phabricator - Dec. 24, 2019, 1:50 p.m.
gracinet created this revision.
Herald added subscribers: mercurial-devel, kevincox, durin42.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  with the removal of the various ensure() it's become
  clear that this doesn't have error cases any more, and we didn't
  need the full match at the end.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7722

AFFECTED FILES
  rust/hg-core/src/discovery.rs

CHANGE DETAILS




To: gracinet, #hg-reviewers
Cc: durin42, kevincox, mercurial-devel

Patch

diff --git a/rust/hg-core/src/discovery.rs b/rust/hg-core/src/discovery.rs
--- a/rust/hg-core/src/discovery.rs
+++ b/rust/hg-core/src/discovery.rs
@@ -266,7 +266,7 @@ 
 
         self.mutate_undecided(
             |oc| oc.compute_undecided(),
-            |wu| wu.add_missing_revisions(missing),
+            |wu| Ok(wu.add_missing_revisions(missing)),
         )
     }
 
@@ -456,10 +456,7 @@ 
     /// caller from `PartialDiscovery` can avoid the undecided set in case
     /// it turns out to be empty (hence restrain
     /// from performing the transition to `WithUndecided`)
-    pub fn add_missing_revisions(
-        &mut self,
-        mut tovisit: VecDeque<Revision>,
-    ) -> Result<(), GraphError> {
+    pub fn add_missing_revisions(&mut self, mut tovisit: VecDeque<Revision>) {
         let mut seen: HashSet<Revision> = HashSet::new();
         let undecided_mut = &mut self.undecided;
         let children = &self.children_cache;
@@ -473,20 +470,14 @@ 
                 continue;
             }
             undecided_mut.remove(&rev);
-            match children.get(&rev) {
-                None => {
-                    continue;
-                }
-                Some(this_children) => {
-                    for child in this_children.iter().cloned() {
-                        if seen.insert(child) {
-                            tovisit.push_back(child);
-                        }
+            if let Some(this_children) = children.get(&rev) {
+                for child in this_children.iter().cloned() {
+                    if seen.insert(child) {
+                        tovisit.push_back(child);
                     }
                 }
             }
         }
-        Ok(())
     }
 
     fn compute_children_cache(