diff --git a/crates/sum_tree/src/tree_map.rs b/crates/sum_tree/src/tree_map.rs index 0397f16182133c77f618d04c0ca32622686c8e25..54e8ae8343f4778e04a37a7ebd3dbe2b6da587cd 100644 --- a/crates/sum_tree/src/tree_map.rs +++ b/crates/sum_tree/src/tree_map.rs @@ -71,10 +71,10 @@ impl TreeMap { } pub fn extend(&mut self, iter: impl IntoIterator) { - let mut edits = Vec::new(); - for (key, value) in iter { - edits.push(Edit::Insert(MapEntry { key, value })); - } + let edits: Vec<_> = iter + .into_iter() + .map(|(key, value)| Edit::Insert(MapEntry { key, value })) + .collect(); self.0.edit(edits, &()); }