From adaafdd7043507cbceae65e78c38954e47103b5c Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 11 May 2020 11:33:45 -0400 Subject: Fix some clippy lints --- src/metric/forest.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/metric/forest.rs') diff --git a/src/metric/forest.rs b/src/metric/forest.rs index 47eb413..887ff12 100644 --- a/src/metric/forest.rs +++ b/src/metric/forest.rs @@ -50,6 +50,24 @@ where } len } + + /// Check if this forest is empty. + pub fn is_empty(&self) -> bool { + if !self.buffer.is_empty() { + return false; + } + + self.trees.iter().flatten().next().is_none() + } +} + +impl Default for Forest +where + U: FromIterator + IntoIterator, +{ + fn default() -> Self { + Self::new() + } } impl Extend for Forest -- cgit v1.2.3