Skip to content

Commit 3968e04

Browse files
committed
fix: broken during rebase of earlier trait change commit
1 parent 458b330 commit 3968e04

2 files changed

Lines changed: 8 additions & 19 deletions

File tree

src/common/generate_nearest_one.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ macro_rules! generate_nearest_one {
9898

9999
if result < nearest {
100100
nearest = result;
101+
let result_entry: [A; K] = *transform(&result_entry);
101102
nearest_entry.copy_from_slice( &result_entry );
102103
}
103104
}
@@ -138,8 +139,10 @@ macro_rules! generate_nearest_one {
138139
if dist < nearest.distance {
139140
nearest.distance = dist;
140141
let item = unsafe { leaf_node.content_items.get_unchecked(idx) };
141-
nearest.item = *transform(item)
142-
nearest_entry.copy_from_slice( entry );
142+
nearest.item = *transform(item);
143+
144+
let entry: &&[A; K] = transform(&entry);
145+
nearest_entry.copy_from_slice( *entry );
143146
}
144147
});
145148
}

src/traits.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Definitions and implementations for some traits that are common between the [`float`](crate::float), [`immutable`](crate::immutable) and [`fixed`](crate::fixed) modules
22
use az::Cast;
33
use divrem::DivCeil;
4-
use num_traits::{One, PrimInt, Unsigned, Zero};
4+
use num_traits::{PrimInt, Unsigned, Zero};
55
use std::fmt::Debug;
66

77
/// Content trait.
@@ -14,23 +14,9 @@ use std::fmt::Debug;
1414
/// a Vec. Try switching to a smaller type and benchmarking to see if you get better
1515
/// performance. Any type that satisfies these trait constraints may be used; in
1616
/// particular, we use T::default() to initialize the KdTree content.
17-
pub trait Content:
18-
PartialEq + Default + Clone + Copy + Ord + Debug + Sync + Send
19-
{
20-
}
17+
pub trait Content: PartialEq + Default + Clone + Copy + Ord + Debug + Sync + Send {}
2118

22-
impl<
23-
T: PartialEq
24-
+ Default
25-
+ Clone
26-
+ Copy
27-
+ Ord
28-
+ Debug
29-
+ Sync
30-
+ Send
31-
> Content for T
32-
{
33-
}
19+
impl<T: PartialEq + Default + Clone + Copy + Ord + Debug + Sync + Send> Content for T {}
3420

3521
/// Implemented on u16 and u32 so that they can be used internally to index the
3622
/// `Vec`s of Stem and Leaf nodes.

0 commit comments

Comments
 (0)