diff options
| author | Chris Gregory <czipperz@gmail.com> | 2019-06-30 11:13:41 -0700 |
|---|---|---|
| committer | Chris Gregory <czipperz@gmail.com> | 2019-07-01 20:21:12 -0700 |
| commit | 8a3797b73618fb6d7591d194dac22c377b4cd371 (patch) | |
| tree | b08d3bd7e732e24e43dbdd68c55bef30bbe929d1 /src | |
| parent | 99abdfa0b515431133cb38d164e794a51ab58e36 (diff) | |
| download | rust-8a3797b73618fb6d7591d194dac22c377b4cd371.tar.gz rust-8a3797b73618fb6d7591d194dac22c377b4cd371.zip | |
Use mem::take instead of mem::replace with default
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/option.rs | 2 | ||||
| -rw-r--r-- | src/libproc_macro/bridge/buffer.rs | 2 |
2 files changed, 2 insertions, 2 deletions
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, 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]) { |
