From 8def096c4de13ba04617040a7848c864b171fde4 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Wed, 9 Feb 2022 17:44:54 -0500 Subject: [PATCH] Delete Decoder::read_map_elt_val --- compiler/rustc_serialize/src/collection_impls.rs | 6 +++--- compiler/rustc_serialize/src/serialize.rs | 8 -------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/compiler/rustc_serialize/src/collection_impls.rs b/compiler/rustc_serialize/src/collection_impls.rs index 439641400d5..38f6b402fc5 100644 --- a/compiler/rustc_serialize/src/collection_impls.rs +++ b/compiler/rustc_serialize/src/collection_impls.rs @@ -82,7 +82,7 @@ fn decode(d: &mut D) -> BTreeMap { 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 @@ -148,7 +148,7 @@ fn decode(d: &mut D) -> HashMap { 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 @@ -227,7 +227,7 @@ fn decode(d: &mut D) -> indexmap::IndexMap { 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 diff --git a/compiler/rustc_serialize/src/serialize.rs b/compiler/rustc_serialize/src/serialize.rs index 53ab6eda6f1..3d87bea5868 100644 --- a/compiler/rustc_serialize/src/serialize.rs +++ b/compiler/rustc_serialize/src/serialize.rs @@ -225,14 +225,6 @@ fn read_map(&mut self, f: F) -> T let len = self.read_usize(); f(self, len) } - - #[inline] - fn read_map_elt_val(&mut self, f: F) -> T - where - F: FnOnce(&mut Self) -> T, - { - f(self) - } } /// Trait for types that can be serialized