about summary refs log tree commit diff
path: root/src/libcore
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/libcore
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/libcore')
-rw-r--r--src/libcore/lib.rs1
-rw-r--r--src/libcore/option.rs2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 04c50329de3..d2d08a075b9 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -126,6 +126,7 @@
 #![feature(adx_target_feature)]
 #![feature(maybe_uninit_slice, maybe_uninit_array)]
 #![feature(external_doc)]
+#![feature(mem_take)]
 
 #[prelude_import]
 #[allow(unused)]
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index eec4b149ddc..a2eff0200b7 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -845,7 +845,7 @@ impl<T> Option<T> {
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn take(&mut self) -> Option<T> {
-        mem::replace(self, None)
+        mem::take(self)
     }
 
     /// Replaces the actual value in the option by the value given in parameter,