summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 8041d28..4792dbb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -274,7 +274,7 @@ struct HeapNeighborhood<K, V, D> {
}
impl<K, V, D: PartialOrd> HeapNeighborhood<K, V, D> {
- /// Create a new singleton neighborhood.
+ /// Create a new HeapNeighborhood.
///
/// * `target`: The search target.
/// * `k`: The number of nearest neighbors to find.
@@ -284,11 +284,11 @@ impl<K, V, D: PartialOrd> HeapNeighborhood<K, V, D> {
target,
k,
threshold,
- heap: BinaryHeap::new(),
+ heap: BinaryHeap::with_capacity(k),
}
}
- /// Convert this result into an optional neighbor.
+ /// Extract the results from this neighborhood.
fn into_vec(self) -> Vec<Neighbor<V, D>> {
self.heap
.into_sorted_vec()