about summary refs log tree commit diff
path: root/src/libproc_macro
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-07-04 01:38:46 +0200
committerGitHub <noreply@github.com>2019-07-04 01:38:46 +0200
commit88c007cd0418e92bbacb8a46d9f9b23422da0d56 (patch)
treef0b6b549f2d818d2e12a6b38eebe6c74e026d536 /src/libproc_macro
parent6cfd474e3337934da9606844e6cf571f96d9652b (diff)
parenteddfad31400b9c6cba6eda95cadd96c455504898 (diff)
downloadrust-88c007cd0418e92bbacb8a46d9f9b23422da0d56.tar.gz
rust-88c007cd0418e92bbacb8a46d9f9b23422da0d56.zip
Rollup merge of #62249 - czipperz:use-mem-take-instead-of-replace-default, r=dtolnay,Centril
Use mem::take instead of mem::replace with default
Diffstat (limited to 'src/libproc_macro')
-rw-r--r--src/libproc_macro/bridge/buffer.rs2
-rw-r--r--src/libproc_macro/lib.rs1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/libproc_macro/bridge/buffer.rs b/src/libproc_macro/bridge/buffer.rs
index 0d8cc552d61..a51e3a9a33d 100644
--- a/src/libproc_macro/bridge/buffer.rs
+++ b/src/libproc_macro/bridge/buffer.rs
@@ -78,7 +78,7 @@ impl<T: Copy> Buffer<T> {
     }
 
     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]) {
diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs
index 1e0f1ed578a..2c097238b95 100644
--- a/src/libproc_macro/lib.rs
+++ b/src/libproc_macro/lib.rs
@@ -25,6 +25,7 @@
 #![feature(extern_types)]
 #![feature(in_band_lifetimes)]
 #![feature(optin_builtin_traits)]
+#![feature(mem_take)]
 #![feature(non_exhaustive)]
 #![feature(specialization)]