# HG changeset patch # User Yuya Nishihara # Date 2019-08-16 09:34:05 # Node ID 88d6a6f7e83716146fc725f20166509a520bc164 # Parent 2e9b29fa3e80f6d2056e74a0ec31786b4d6dadbb rust-discovery: use while loop instead of match + break This looks slightly nicer. 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 @@ -65,13 +65,7 @@ where let mut visit: VecDeque = heads.into_iter().collect(); let mut factor: u32 = 1; let mut seen: HashSet = 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; }