mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-03 17:44:30 +00:00
Relax TreeMap value bounds, fix warnings, simplify cmp
This commit is contained in:
parent
49d1c9d1ba
commit
0639c8331c
1 changed files with 4 additions and 8 deletions
|
@ -5,7 +5,7 @@ use crate::{Bias, Dimension, Item, KeyedItem, SeekTarget, SumTree, Summary};
|
||||||
pub struct TreeMap<K, V>(SumTree<MapEntry<K, V>>)
|
pub struct TreeMap<K, V>(SumTree<MapEntry<K, V>>)
|
||||||
where
|
where
|
||||||
K: Clone + Debug + Default,
|
K: Clone + Debug + Default,
|
||||||
V: Clone + Debug + Default;
|
V: Clone + Debug;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct MapEntry<K, V> {
|
pub struct MapEntry<K, V> {
|
||||||
|
@ -81,7 +81,7 @@ where
|
||||||
{
|
{
|
||||||
type Context = ();
|
type Context = ();
|
||||||
|
|
||||||
fn add_summary(&mut self, summary: &Self, cx: &()) {
|
fn add_summary(&mut self, summary: &Self, _: &()) {
|
||||||
*self = summary.clone()
|
*self = summary.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,11 +99,7 @@ impl<'a, K> SeekTarget<'a, MapKey<K>, MapKeyRef<'a, K>> for MapKeyRef<'_, K>
|
||||||
where
|
where
|
||||||
K: Clone + Debug + Default + Ord,
|
K: Clone + Debug + Default + Ord,
|
||||||
{
|
{
|
||||||
fn cmp(&self, cursor_location: &MapKeyRef<K>, cx: &()) -> Ordering {
|
fn cmp(&self, cursor_location: &MapKeyRef<K>, _: &()) -> Ordering {
|
||||||
if let Some(key) = cursor_location.0 {
|
|
||||||
self.0.cmp(&cursor_location.0)
|
self.0.cmp(&cursor_location.0)
|
||||||
} else {
|
|
||||||
Ordering::Greater
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue