From d8564b725c954b4f4c65ef6e0f9bf8cc7a421394 Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Fri, 7 Sep 2018 09:53:35 -0600 Subject: [PATCH] Don't reference window to get each slot --- src/window.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/window.rs b/src/window.rs index 7eb6c313f1..ed9a476d92 100644 --- a/src/window.rs +++ b/src/window.rs @@ -50,16 +50,17 @@ fn find_next_missing( (consumed..received) .filter_map(|pix| { let i = (pix % WINDOW_SIZE) as usize; + let ref mut slot = &mut window[i]; - if let Some(blob) = mem::replace(&mut window[i].data, None) { + if let Some(blob) = mem::replace(&mut slot.data, None) { let blob_idx = blob.read().unwrap().get_index().unwrap(); if blob_idx == pix { - mem::replace(&mut window[i].data, Some(blob)); + mem::replace(&mut slot.data, Some(blob)); } else { recycler.recycle(blob, "find_next_missing"); } } - if window[i].data.is_none() { + if slot.data.is_none() { let val = crdt.read().unwrap().window_index_request(pix as u64); if let Ok((to, req)) = val { return Some((to, req));