diff options
| author | Chris Gregory <czipperz@gmail.com> | 2019-06-30 11:30:01 -0700 |
|---|---|---|
| committer | Chris Gregory <czipperz@gmail.com> | 2019-07-01 20:21:12 -0700 |
| commit | 636f5e6d1120c2bfc264687fbe1e77312c8d2979 (patch) | |
| tree | 6efc5c4df7f031bee45ce2e8409706981244ec34 /src/libstd | |
| parent | 8a3797b73618fb6d7591d194dac22c377b4cd371 (diff) | |
| download | rust-636f5e6d1120c2bfc264687fbe1e77312c8d2979.tar.gz rust-636f5e6d1120c2bfc264687fbe1e77312c8d2979.zip | |
Convert more usages over
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/panicking.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/sync.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/windows/pipe.rs | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index 797d85e941d..952fd9ebfdf 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -364,7 +364,7 @@ fn continue_panic_fmt(info: &PanicInfo<'_>) -> ! { unsafe impl<'a> BoxMeUp for PanicPayload<'a> { fn box_me_up(&mut self) -> *mut (dyn Any + Send) { - let contents = mem::replace(self.fill(), String::new()); + let contents = mem::take(self.fill()); Box::into_raw(Box::new(contents)) } diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs index 3c4f8e077c9..f8fcd3ff5a5 100644 --- a/src/libstd/sync/mpsc/sync.rs +++ b/src/libstd/sync/mpsc/sync.rs @@ -383,7 +383,7 @@ impl<T> Packet<T> { // needs to be careful to destroy the data *outside* of the lock to // prevent deadlock. let _data = if guard.cap != 0 { - mem::replace(&mut guard.buf.buf, Vec::new()) + mem::take(&mut guard.buf.buf) } else { Vec::new() }; diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs index 493ee8a9a2d..c77f30dfc71 100644 --- a/src/libstd/sys/windows/pipe.rs +++ b/src/libstd/sys/windows/pipe.rs @@ -342,7 +342,7 @@ impl<'a> Drop for AsyncPipe<'a> { // If anything here fails, there's not really much we can do, so we leak // the buffer/OVERLAPPED pointers to ensure we're at least memory safe. if self.pipe.cancel_io().is_err() || self.result().is_err() { - let buf = mem::replace(self.dst, Vec::new()); + let buf = mem::take(self.dst); let overlapped = Box::new(unsafe { mem::zeroed() }); let overlapped = mem::replace(&mut self.overlapped, overlapped); mem::forget((buf, overlapped)); |
