summaryrefslogtreecommitdiffstats
path: root/src/frontier
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-05-11 11:33:45 -0400
committerTavian Barnes <tavianator@tavianator.com>2020-05-11 11:33:45 -0400
commitadaafdd7043507cbceae65e78c38954e47103b5c (patch)
treec8e2b62b2f39e0f2dc7908ca613df92dd7b541c1 /src/frontier
parent825515439247853af3714d3135051a83bd84d2e0 (diff)
downloadkd-forest-adaafdd7043507cbceae65e78c38954e47103b5c.tar.xz
Fix some clippy lints
Diffstat (limited to 'src/frontier')
-rw-r--r--src/frontier/image.rs4
-rw-r--r--src/frontier/mean.rs4
-rw-r--r--src/frontier/min.rs4
3 files changed, 12 insertions, 0 deletions
diff --git a/src/frontier/image.rs b/src/frontier/image.rs
index 3655580..5642297 100644
--- a/src/frontier/image.rs
+++ b/src/frontier/image.rs
@@ -51,6 +51,10 @@ impl<C: ColorSpace> Frontier for ImageFrontier<C> {
self.len - self.deleted
}
+ fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+
fn place(&mut self, rgb8: Rgb8) -> Option<(u32, u32)> {
let color = C::from(rgb8);
diff --git a/src/frontier/mean.rs b/src/frontier/mean.rs
index 889c5ba..6a32b97 100644
--- a/src/frontier/mean.rs
+++ b/src/frontier/mean.rs
@@ -129,6 +129,10 @@ impl<C: ColorSpace> Frontier for MeanFrontier<C> {
self.len - self.deleted
}
+ fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+
fn place(&mut self, rgb8: Rgb8) -> Option<(u32, u32)> {
let color = C::from(rgb8);
let (x, y) = self.forest.nearest(&color).map(|n| n.item.pos)?;
diff --git a/src/frontier/min.rs b/src/frontier/min.rs
index b22b290..269f3b7 100644
--- a/src/frontier/min.rs
+++ b/src/frontier/min.rs
@@ -136,6 +136,10 @@ impl<C: ColorSpace, R: Rng> Frontier for MinFrontier<C, R> {
self.len - self.deleted
}
+ fn is_empty(&self) -> bool {
+ self.len() == 0
+ }
+
fn place(&mut self, rgb8: Rgb8) -> Option<(u32, u32)> {
let color = C::from(rgb8);
let (x, y) = self