diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-06-28 12:34:49 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-06-28 12:34:49 -0400 |
commit | 5aa0fd44535faa0ea1c0522b089e16d4b57e4e6f (patch) | |
tree | 1dcc37412195f0851dd86b836368bf809a35b4b4 /src/kd.rs | |
parent | 7ce5a60f5fc69f9c47cdae2762b14873d3e90733 (diff) | |
download | acap-5aa0fd44535faa0ea1c0522b089e16d4b57e4e6f.tar.xz |
Apply some rustfmt suggestions
Diffstat (limited to 'src/kd.rs')
-rw-r--r-- | src/kd.rs | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1,6 +1,6 @@ //! [k-d trees](https://en.wikipedia.org/wiki/K-d_tree). -use crate::coords::{Coordinates, CoordinateMetric, CoordinateProximity}; +use crate::coords::{CoordinateMetric, CoordinateProximity, Coordinates}; use crate::distance::{Metric, Proximity}; use crate::util::Ordered; use crate::{ExactNeighbors, NearestNeighbors, Neighborhood}; @@ -200,9 +200,7 @@ pub struct KdTree<T> { impl<T: Coordinates> KdTree<T> { /// Create an empty tree. pub fn new() -> Self { - Self { - root: None, - } + Self { root: None } } /// Create a balanced tree out of a sequence of items. @@ -378,7 +376,7 @@ impl<T: Coordinates> FlatKdNode<T> { nodes.swap(0, mid); let (node, children) = nodes.split_first_mut().unwrap(); - let (left, right) = children.split_at_mut(mid); + let (left, right) = children.split_at_mut(mid); node.left_len = left.len(); let next = (level + 1) % node.item.dims(); @@ -477,7 +475,9 @@ where { if !self.nodes.is_empty() { let mut closest = neighborhood.target().as_vec(); - self.nodes.as_slice().search(0, &mut closest, &mut neighborhood); + self.nodes + .as_slice() + .search(0, &mut closest, &mut neighborhood); } neighborhood } |