Skip to content

Commit 8755788

Browse files
RUST-1032 Avoid redundant allocations in Collection::clone_with_type (#467)
1 parent 0de2f2b commit 8755788

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/coll/mod.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,10 @@ impl<T> Collection<T> {
167167

168168
/// Gets a clone of the `Collection` with a different type `U`.
169169
pub fn clone_with_type<U>(&self) -> Collection<U> {
170-
let options = CollectionOptions::builder()
171-
.selection_criteria(self.inner.selection_criteria.clone())
172-
.read_concern(self.inner.read_concern.clone())
173-
.write_concern(self.inner.write_concern.clone())
174-
.build();
175-
176-
Collection::new(self.inner.db.clone(), &self.inner.name, Some(options))
170+
Collection {
171+
inner: self.inner.clone(),
172+
_phantom: Default::default(),
173+
}
177174
}
178175

179176
/// Get the `Client` that this collection descended from.

0 commit comments

Comments
 (0)