Skip to content

Commit 54873fd

Browse files
committed
Resolve mem_replace_with_default clippy lint
warning: replacing a value of type `T` with `T::default()` is better expressed using `std::mem::take` --> src/rcvec.rs:56:13 | 56 | mem::replace(owned, Vec::new()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::mem::take(owned)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mem_replace_with_default = note: `-W clippy::mem-replace-with-default` implied by `-W clippy::all`
1 parent 8dba582 commit 54873fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/rcvec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl<T> RcVec<T> {
5353
T: Clone,
5454
{
5555
let vec = if let Some(owned) = Rc::get_mut(&mut self.inner) {
56-
mem::replace(owned, Vec::new())
56+
mem::take(owned)
5757
} else {
5858
Vec::clone(&self.inner)
5959
};

0 commit comments

Comments
 (0)