Mercurial > hg
changeset 42764:798b7d4b463e
rust-discovery: use while loop instead of match + break
This looks slightly nicer.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 16 Aug 2019 18:34:05 +0900 |
parents | 04c3b76fa7a3 |
children | 0770e221d24b |
files | rust/hg-core/src/discovery.rs |
diffstat | 1 files changed, 1 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/rust/hg-core/src/discovery.rs Fri Aug 16 18:31:17 2019 +0900 +++ b/rust/hg-core/src/discovery.rs Fri Aug 16 18:34:05 2019 +0900 @@ -65,13 +65,7 @@ let mut visit: VecDeque<Revision> = heads.into_iter().collect(); let mut factor: u32 = 1; let mut seen: HashSet<Revision> = HashSet::new(); - loop { - let current = match visit.pop_front() { - None => { - break; - } - Some(r) => r, - }; + while let Some(current) = visit.pop_front() { if !seen.insert(current) { continue; }