Make Search::reset() more robust to future changes

This commit is contained in:
Dirkjan Ochtman 2020-12-16 12:39:28 +01:00
parent 098a4e4ef6
commit 1871b61b08
1 changed files with 12 additions and 4 deletions

View File

@ -217,10 +217,18 @@ pub struct Search {
impl Search { impl Search {
/// Resets the state to be ready for a new search /// Resets the state to be ready for a new search
fn reset(&mut self) { fn reset(&mut self) {
self.visited.clear(); let Search {
self.candidates.clear(); visited,
self.nearest.clear(); candidates,
self.furthest = OrderedFloat::from(f32::INFINITY); nearest,
num: _,
furthest,
} = self;
visited.clear();
candidates.clear();
nearest.clear();
*furthest = OrderedFloat::from(f32::INFINITY);
} }
/// Track node `pid` as a potential new neighbor for the given `point` /// Track node `pid` as a potential new neighbor for the given `point`