Skip to content

Commit

Permalink
Fix a pedantic clippy lint
Browse files Browse the repository at this point in the history
  • Loading branch information
tgecho committed Nov 24, 2023
1 parent acedb4f commit 7f367a0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions canrun/src/core/mkmvmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ pub struct MKMVMap<K: Eq + Hash + Clone + fmt::Debug, V: Clone> {
#[derive(Clone)]
pub(crate) struct Value<K, V> {
id: usize,
pub keys: Vec<K>,
pub value: V,
keys: Vec<K>,
data: V,
}

impl<K: Eq, V: PartialEq> PartialEq for Value<K, V> {
fn eq(&self, other: &Self) -> bool {
self.id == other.id && self.keys == other.keys && self.value == other.value
self.id == other.id && self.keys == other.keys && self.data == other.data
}
}

Expand All @@ -39,7 +39,7 @@ impl<K: Eq + Hash + Clone + fmt::Debug, V: Clone> MKMVMap<K, V> {
}
}

pub fn add(&mut self, keys: Vec<K>, value: V) {
pub fn add(&mut self, keys: Vec<K>, data: V) {
let id = self.current_id;
self.current_id += 1;
self.keys = keys.iter().fold(self.keys.clone(), |keys, key| {
Expand All @@ -48,7 +48,7 @@ impl<K: Eq + Hash + Clone + fmt::Debug, V: Clone> MKMVMap<K, V> {
key.clone(),
)
});
self.values = self.values.update(id, Value { id, keys, value });
self.values = self.values.update(id, Value { id, keys, data });
}

pub fn extract(&mut self, key: &K) -> Option<Vec<V>> {
Expand All @@ -75,7 +75,7 @@ impl<K: Eq + Hash + Clone + fmt::Debug, V: Clone> MKMVMap<K, V> {
},
key.clone(),
);
values.push(value.value);
values.push(value.data);
}
}
Some(values)
Expand Down

0 comments on commit 7f367a0

Please sign in to comment.