diff --git a/src/libcore/option.rs b/src/libcore/option.rs index eec4b149ddc7..a2eff0200b77 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -845,7 +845,7 @@ impl Option { #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn take(&mut self) -> Option { - mem::replace(self, None) + mem::take(self) } /// Replaces the actual value in the option by the value given in parameter, diff --git a/src/libproc_macro/bridge/buffer.rs b/src/libproc_macro/bridge/buffer.rs index 0d8cc552d61a..a51e3a9a33d7 100644 --- a/src/libproc_macro/bridge/buffer.rs +++ b/src/libproc_macro/bridge/buffer.rs @@ -78,7 +78,7 @@ impl Buffer { } pub(super) fn take(&mut self) -> Self { - mem::replace(self, Self::default()) + mem::take(self) } pub(super) fn extend_from_slice(&mut self, xs: &[T]) {