diff --git a/src/map.rs b/src/map.rs index 87cf54566..c17920bd9 100644 --- a/src/map.rs +++ b/src/map.rs @@ -197,9 +197,8 @@ impl Map { #[inline] pub fn append(&mut self, other: &mut Self) { #[cfg(feature = "preserve_order")] - for (k, v) in mem::replace(&mut other.map, MapImpl::default()) { - self.map.insert(k, v); - } + self.map + .extend(mem::replace(&mut other.map, MapImpl::default())); #[cfg(not(feature = "preserve_order"))] self.map.append(&mut other.map); } @@ -304,6 +303,11 @@ impl Clone for Map { map: self.map.clone(), } } + + #[inline] + fn clone_from(&mut self, source: &Self) { + self.map.clone_from(&source.map) + } } impl PartialEq for Map {