Mercurial > hg
changeset 41133:a1b3800c8a19
rust-ancestors: remove unreachable conditions from missing_ancestors()
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 19 Dec 2018 21:52:40 +0900 |
parents | 55dc1da8df2f |
children | 17a195676472 |
files | rust/hg-core/src/ancestors.rs |
diffstat | 1 files changed, 4 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/ancestors.rs Wed Dec 19 21:51:08 2018 +0900 +++ b/rust/hg-core/src/ancestors.rs Wed Dec 19 21:52:40 2018 +0900 @@ -338,23 +338,13 @@ } continue; } - // in Rust, one can't just use mutable variables assignation - // to be more straightforward. Instead of Python's - // thisvisit and othervisit, we'll differentiate with a boolean - let this_visit_is_revs; if revs_visit.remove(&curr) { missing.push(curr); - this_visit_is_revs = true; for p in self.graph.parents(curr)?.iter().cloned() { if p == NULL_REVISION { continue; } - let in_other_visit = if this_visit_is_revs { - bases_visit.contains(&p) - } else { - revs_visit.contains(&p) - }; - if in_other_visit || both_visit.contains(&p) { + if bases_visit.contains(&p) || both_visit.contains(&p) { // p is implicitely in this_visit. // This means p is or should be in bothvisit // TODO optim: hence if bothvisit, we look up twice @@ -363,25 +353,15 @@ both_visit.insert(p); } else { // visit later - if this_visit_is_revs { - revs_visit.insert(p); - } else { - bases_visit.insert(p); - } + revs_visit.insert(p); } } } else if bases_visit.contains(&curr) { - this_visit_is_revs = false; for p in self.graph.parents(curr)?.iter().cloned() { if p == NULL_REVISION { continue; } - let in_other_visit = if this_visit_is_revs { - bases_visit.contains(&p) - } else { - revs_visit.contains(&p) - }; - if in_other_visit || both_visit.contains(&p) { + if revs_visit.contains(&p) || both_visit.contains(&p) { // p is implicitely in this_visit. // This means p is or should be in bothvisit // TODO optim: hence if bothvisit, we look up twice @@ -390,11 +370,7 @@ both_visit.insert(p); } else { // visit later - if this_visit_is_revs { - revs_visit.insert(p); - } else { - bases_visit.insert(p); - } + bases_visit.insert(p); } } } else {