Skip to content

Commit 8a3797b

Browse files
committed
Use mem::take instead of mem::replace with default
1 parent 99abdfa commit 8a3797b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/libcore/option.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ impl<T> Option<T> {
845845
#[inline]
846846
#[stable(feature = "rust1", since = "1.0.0")]
847847
pub fn take(&mut self) -> Option<T> {
848-
mem::replace(self, None)
848+
mem::take(self)
849849
}
850850

851851
/// Replaces the actual value in the option by the value given in parameter,

src/libproc_macro/bridge/buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<T: Copy> Buffer<T> {
7878
}
7979

8080
pub(super) fn take(&mut self) -> Self {
81-
mem::replace(self, Self::default())
81+
mem::take(self)
8282
}
8383

8484
pub(super) fn extend_from_slice(&mut self, xs: &[T]) {

0 commit comments

Comments
 (0)