From 0639c8331c2e6e86ec273d480bcf1afc8df34c27 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Fri, 10 Dec 2021 23:35:24 -0700 Subject: [PATCH] Relax TreeMap value bounds, fix warnings, simplify cmp --- crates/sum_tree/src/tree_map.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/sum_tree/src/tree_map.rs b/crates/sum_tree/src/tree_map.rs index d5ca7c1327..75405cbef4 100644 --- a/crates/sum_tree/src/tree_map.rs +++ b/crates/sum_tree/src/tree_map.rs @@ -5,7 +5,7 @@ use crate::{Bias, Dimension, Item, KeyedItem, SeekTarget, SumTree, Summary}; pub struct TreeMap(SumTree>) where K: Clone + Debug + Default, - V: Clone + Debug + Default; + V: Clone + Debug; #[derive(Clone)] pub struct MapEntry { @@ -81,7 +81,7 @@ where { type Context = (); - fn add_summary(&mut self, summary: &Self, cx: &()) { + fn add_summary(&mut self, summary: &Self, _: &()) { *self = summary.clone() } } @@ -99,11 +99,7 @@ impl<'a, K> SeekTarget<'a, MapKey, MapKeyRef<'a, K>> for MapKeyRef<'_, K> where K: Clone + Debug + Default + Ord, { - fn cmp(&self, cursor_location: &MapKeyRef, cx: &()) -> Ordering { - if let Some(key) = cursor_location.0 { - self.0.cmp(&cursor_location.0) - } else { - Ordering::Greater - } + fn cmp(&self, cursor_location: &MapKeyRef, _: &()) -> Ordering { + self.0.cmp(&cursor_location.0) } }