Use mem::take instead of mem::replace with default
This commit is contained in:
parent
99abdfa0b5
commit
8a3797b736
2 changed files with 2 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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]) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue