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 ++++++++++++++++++ src/metric/soft.rs | 10 ++++++++++ 2 files changed, 28 insertions(+) (limited to 'src/metric') 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 diff --git a/src/metric/soft.rs b/src/metric/soft.rs index 0d7dcdb..d443bfd 100644 --- a/src/metric/soft.rs +++ b/src/metric/soft.rs @@ -82,6 +82,16 @@ where } } +impl Default for SoftSearch +where + T: SoftDelete, + U: FromIterator + IntoIterator, +{ + fn default() -> Self { + Self::new() + } +} + impl> Extend for SoftSearch { fn extend>(&mut self, iter: I) { self.0.extend(iter); -- cgit v1.2.3