rust: rename local variables in AncestorsIterator::next
authorGeorges Racinet <georges@racinet.fr>
Tue, 04 Dec 2018 14:01:13 +0000
changeset 53597 70976974c14a929acc4f73bf672c57d53fad6810
parent 53596 59aed775610a54add37893185ff2226d30161523
child 53598 9072a890e5233953896e1579250b561151bdc87d
push id1079
push usergszorc@mozilla.com
push dateMon, 10 Dec 2018 19:44:59 +0000
rust: rename local variables in AncestorsIterator::next It was confusing to have p1 and parents.1 ; (p1, p2) is clearer. Differential Revision: https://phab.mercurial-scm.org/D5365
rust/hg-core/src/ancestors.rs
--- a/rust/hg-core/src/ancestors.rs
+++ b/rust/hg-core/src/ancestors.rs
@@ -121,29 +121,28 @@ impl<G: Graph> Iterator for AncestorsIte
 
     fn next(&mut self) -> Option<Revision> {
         let current = match self.visit.peek() {
             None => {
                 return None;
             }
             Some(c) => *c,
         };
-        let parents = self
+        let (p1, p2) = self
             .graph
             .parents(current)
             .unwrap_or((NULL_REVISION, NULL_REVISION));
-        let p1 = parents.0;
         if p1 < self.stoprev || self.seen.contains(&p1) {
             self.visit.pop();
         } else {
             *(self.visit.peek_mut().unwrap()) = p1;
             self.seen.insert(p1);
         };
 
-        self.conditionally_push_rev(parents.1);
+        self.conditionally_push_rev(p2);
         Some(current)
     }
 }
 
 #[cfg(test)]
 mod tests {
 
     use super::*;