Skip to content

Commit

Permalink
Delete Decoder::read_map_elt_val
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Feb 20, 2022
1 parent 025e1b5 commit 8def096
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_serialize/src/collection_impls.rs
Expand Up @@ -82,7 +82,7 @@ where
let mut map = BTreeMap::new();
for _ in 0..len {
let key = Decodable::decode(d);
let val = d.read_map_elt_val(|d| Decodable::decode(d));
let val = Decodable::decode(d);
map.insert(key, val);
}
map
Expand Down Expand Up @@ -148,7 +148,7 @@ where
let mut map = HashMap::with_capacity_and_hasher(len, state);
for _ in 0..len {
let key = Decodable::decode(d);
let val = d.read_map_elt_val(|d| Decodable::decode(d));
let val = Decodable::decode(d);
map.insert(key, val);
}
map
Expand Down Expand Up @@ -227,7 +227,7 @@ where
let mut map = indexmap::IndexMap::with_capacity_and_hasher(len, state);
for _ in 0..len {
let key = Decodable::decode(d);
let val = d.read_map_elt_val(|d| Decodable::decode(d));
let val = Decodable::decode(d);
map.insert(key, val);
}
map
Expand Down
8 changes: 0 additions & 8 deletions compiler/rustc_serialize/src/serialize.rs
Expand Up @@ -225,14 +225,6 @@ pub trait Decoder {
let len = self.read_usize();
f(self, len)
}

#[inline]
fn read_map_elt_val<T, F>(&mut self, f: F) -> T
where
F: FnOnce(&mut Self) -> T,
{
f(self)
}
}

/// Trait for types that can be serialized
Expand Down

0 comments on commit 8def096

Please sign in to comment.