diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index dfd7b4fbf1..ca1b988d05 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -6255,16 +6255,19 @@ fn split_operations( #[cfg(not(any(test, feature = "test-support")))] const CHUNK_SIZE: usize = 100; + let mut done = false; std::iter::from_fn(move || { - if operations.is_empty() { + if done { return None; } - Some( - operations - .drain(..cmp::min(CHUNK_SIZE, operations.len())) - .collect(), - ) + let operations = operations + .drain(..cmp::min(CHUNK_SIZE, operations.len())) + .collect::>(); + if operations.is_empty() { + done = true; + } + Some(operations) }) }