Use mem::take instead of mem::replace with default

This commit is contained in:
Chris Gregory 2019-06-30 11:13:41 -07:00
parent 99abdfa0b5
commit 8a3797b736
2 changed files with 2 additions and 2 deletions

View File

@ -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,

View File

@ -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]) {