From 9b5ca1ea2940badd4dd1987494e5829969fbf5d8 Mon Sep 17 00:00:00 2001 From: Nicholas Rodrigues Lordello Date: Wed, 4 Oct 2023 15:29:46 +0200 Subject: [PATCH] Avoid Collecting Driver Solutions in RunLoop (#1916) # Description Follow up to #1914 This PR just removes the unnecessary `collect` in the `flat_map` closure. ## How to test CI. --- crates/autopilot/src/run_loop.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/autopilot/src/run_loop.rs b/crates/autopilot/src/run_loop.rs index 23c8a1fe5e..5e35b9907f 100644 --- a/crates/autopilot/src/run_loop.rs +++ b/crates/autopilot/src/run_loop.rs @@ -98,13 +98,12 @@ impl RunLoop { .flat_map(|(index, response)| { if response.solutions.is_empty() { tracing::debug!(driver = ?self.drivers[index].url, "driver sent zero solutions"); - return vec![]; } response .solutions .into_iter() - .filter_map(|solution| { + .filter_map(move |solution| { if solution.score == U256::zero() { tracing::debug!( id = ?solution.solution_id, @@ -116,7 +115,6 @@ impl RunLoop { Some((index, solution)) } }) - .collect_vec() }) .collect_vec();