From 459f5e4d65d83736f9d88379403bd347817bca19 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 7 Jan 2021 15:58:46 +0100 Subject: [PATCH] Tweak style --- src/lib.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f93047e..a39b7d8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -276,13 +276,11 @@ fn insert(layer: &mut Vec, new: PointId, found: &[Candidate] } let nearest = &mut layer[pid.0 as usize].nearest; - if !nearest[idx].is_valid() { - nearest[idx] = new; - continue; + if nearest[idx].is_valid() { + let end = (M * 2) - 1; + nearest.copy_within(idx..end, idx + 1); } - let end = (M * 2) - 1; - nearest.copy_within(idx..end, idx + 1); nearest[idx] = new; } @@ -334,8 +332,8 @@ impl Search { visited, candidates, nearest, - ef: _, furthest, + ef: _, } = self; visited.clear();