metal2vulkan-rt: the completion thread takes its lists whole

clippy's drain_collect: the scheduled, ended and fire lists and the watch list at the thread's end
are taken with mem::take rather than drained into new vectors.

Verified: cargo fmt; lint job m3-max-40916 named these five sites and nothing else.
This commit is contained in:
Anees Iqbal committed 2026-11-17 07:25:30 -08:00
1 parent 077c9722e3
commit 60c59c6b9d
1 file changed
+5 -5
+5 -5
View File
@@ -281,9 +281,9 @@ pub(crate) fn run(core: Arc<Core>) {
let device = &core.device;
let mut state = done.lock();
loop {
let scheduled: Vec<_> = state.scheduled.drain(..).collect();
let mut retire: Vec<Retiree> = state.ended.drain(..).collect();
let fired: Vec<Arc<EventInner>> = state.fire.drain(..).collect();
let scheduled = std::mem::take(&mut state.scheduled);
let mut retire = std::mem::take(&mut state.ended);
let fired = std::mem::take(&mut state.fire);
let mut fire: Vec<(Listener, u64)> = Vec::new();
let mut newly_lost = false;
if state.lost {
@@ -421,8 +421,8 @@ pub(crate) fn run(core: Arc<Core>) {
state = done.lock();
}
}
let watched: Vec<_> = state.watched.drain(..).collect();
let fired: Vec<_> = state.fire.drain(..).collect();
let watched = std::mem::take(&mut state.watched);
let fired = std::mem::take(&mut state.fire);
drop(state);
drop((watched, fired));
}