Delete Decoder::read_map_elt_key

This commit is contained in:
Mark Rousskov 2022-02-09 17:44:09 -05:00
parent 38e6dad1d3
commit 025e1b581a
2 changed files with 3 additions and 11 deletions

View File

@ -81,7 +81,7 @@ where
d.read_map(|d, len| {
let mut map = BTreeMap::new();
for _ in 0..len {
let key = d.read_map_elt_key(|d| Decodable::decode(d));
let key = Decodable::decode(d);
let val = d.read_map_elt_val(|d| Decodable::decode(d));
map.insert(key, val);
}
@ -147,7 +147,7 @@ where
let state = Default::default();
let mut map = HashMap::with_capacity_and_hasher(len, state);
for _ in 0..len {
let key = d.read_map_elt_key(|d| Decodable::decode(d));
let key = Decodable::decode(d);
let val = d.read_map_elt_val(|d| Decodable::decode(d));
map.insert(key, val);
}
@ -226,7 +226,7 @@ where
let state = Default::default();
let mut map = indexmap::IndexMap::with_capacity_and_hasher(len, state);
for _ in 0..len {
let key = d.read_map_elt_key(|d| Decodable::decode(d));
let key = Decodable::decode(d);
let val = d.read_map_elt_val(|d| Decodable::decode(d));
map.insert(key, val);
}

View File

@ -226,14 +226,6 @@ pub trait Decoder {
f(self, len)
}
#[inline]
fn read_map_elt_key<T, F>(&mut self, f: F) -> T
where
F: FnOnce(&mut Self) -> T,
{
f(self)
}
#[inline]
fn read_map_elt_val<T, F>(&mut self, f: F) -> T
where