From a6a1d11b3e608a7e2b416527c0cc0a2729face74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Sat, 2 Mar 2019 01:13:06 +0100 Subject: [PATCH] Remove unwanted loop --- src/lib.rs | 57 ++++++++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 515c700..6bf878e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -418,43 +418,40 @@ impl BenchmarkRepository active_job_ids.insert(job_id); } - loop + while !active_job_ids.is_empty() { - while !active_job_ids.is_empty() - { - active_job_ids.retain - ( - |job_id| + active_job_ids.retain + ( + |job_id| + { + let job_repository_path = self.result_repository_path(*job_id); + let job_repository = match Repository::open(&job_repository_path) { - let job_repository_path = self.result_repository_path(*job_id); - let job_repository = match Repository::open(&job_repository_path) - { - Ok(value) => value, - Err(error) => panic!("cannot access result repository for job {}: {}", job_id, error), - }; + Ok(value) => value, + Err(error) => panic!("cannot access result repository for job {}: {}", job_id, error), + }; - let job_commit = match Self::tip_commit(&job_repository, false, "master") - { - Ok(value) => value, - // Job is not done yet, so skip it until it is - Err(_) => return true, - }; + let job_commit = match Self::tip_commit(&job_repository, false, "master") + { + Ok(value) => value, + // Job is not done yet, so skip it until it is + Err(_) => return true, + }; - info!("job {} finished", job_id); + info!("job {} finished", job_id); - let remote_commit = match Self::tip_commit(&self.repository, true, "results") - { - Ok(value) => value, - Err(error) => panic!("could not access tip commit of “results” branch: {}", error), - }; + let remote_commit = match Self::tip_commit(&self.repository, true, "results") + { + Ok(value) => value, + Err(error) => panic!("could not access tip commit of “results” branch: {}", error), + }; - false - } - ); + false + } + ); - println!("================"); - std::thread::sleep(std::time::Duration::from_secs(2)); - } + println!("================"); + std::thread::sleep(std::time::Duration::from_secs(2)); } } }