diff --git a/src/lib.rs b/src/lib.rs index 98af4ff1f..0a8ca8bda 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1375,7 +1375,7 @@ impl Build { cell_update(&pendings, |mut pendings| { // Try waiting on them. - retain_unordered_mut(&mut pendings, |(cmd, program, child, _token)| { + parallel::retain_unordered_mut(&mut pendings, |(cmd, program, child, _token)| { match try_wait_on_child(cmd, program, &mut child.0, &mut stdout) { Ok(Some(())) => { // Task done, remove the entry @@ -4344,21 +4344,3 @@ impl Drop for PrintThread { self.handle.take().unwrap().join().unwrap(); } } - -/// Remove all element in `vec` which `f(element)` returns `false`. -/// -/// TODO: Remove this once the MSRV is bumped to v1.61 -#[cfg(feature = "parallel")] -fn retain_unordered_mut(vec: &mut Vec, mut f: F) -where - F: FnMut(&mut T) -> bool, -{ - let mut i = 0; - while i < vec.len() { - if f(&mut vec[i]) { - i += 1; - } else { - vec.swap_remove(i); - } - } -} diff --git a/src/parallel/mod.rs b/src/parallel/mod.rs index e970fd411..61939197d 100644 --- a/src/parallel/mod.rs +++ b/src/parallel/mod.rs @@ -1,2 +1,19 @@ pub(crate) mod async_executor; pub(crate) mod job_token; + +/// Remove all element in `vec` which `f(element)` returns `false`. +/// +/// TODO: Remove this once the MSRV is bumped to v1.61 +pub(crate) fn retain_unordered_mut(vec: &mut Vec, mut f: F) +where +F: FnMut(&mut T) -> bool, +{ + let mut i = 0; + while i < vec.len() { + if f(&mut vec[i]) { + i += 1; + } else { + vec.swap_remove(i); + } + } +}