Skip to content

Commit 9d58198

Browse files
committed
Use BTreeMap::new() in BTreeMap::clone()
1 parent a2eb1f3 commit 9d58198

File tree

1 file changed

+1
-6
lines changed
  • src/liballoc/collections/btree

1 file changed

+1
-6
lines changed

src/liballoc/collections/btree/map.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,7 @@ impl<K: Clone + Ord, V: Clone> Clone for BTreeMap<K, V> {
201201
}
202202

203203
if self.is_empty() {
204-
// Ideally we'd call `BTreeMap::new` here, but that has the `K:
205-
// Ord` constraint, which this method lacks.
206-
BTreeMap {
207-
root: node::Root::shared_empty_root(),
208-
length: 0,
209-
}
204+
BTreeMap::new()
210205
} else {
211206
clone_subtree(self.root.as_ref())
212207
}

0 commit comments

Comments
 (0)