about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-07 14:46:53 +0200
committerGitHub <noreply@github.com>2020-04-07 14:46:53 +0200
commit795bc2ccff5672389c1e9d2481f25bdcdfee299b (patch)
tree102f79b2bf4261484fb3354568a648c92c2fc2ae /src/libstd/sys
parent39b62533c7f9d0581a6ea9b9fc2cc51f21c3b5b0 (diff)
parentf854070bb820501d88d1b029660bfde663595530 (diff)
downloadrust-795bc2ccff5672389c1e9d2481f25bdcdfee299b.tar.gz
rust-795bc2ccff5672389c1e9d2481f25bdcdfee299b.zip
Rollup merge of #70201 - cuviper:clone_into, r=dtolnay
Small tweaks in ToOwned::clone_into

- `<[T]>::clone_into` is slightly more optimized.
- `CStr::clone_into` is new, letting it reuse its allocation.
- `OsStr::clone_into` now forwards to the underlying slice/`Vec`.
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/windows/os_str.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/sys/windows/os_str.rs b/src/libstd/sys/windows/os_str.rs
index 6aab028873e..2f5fc72ab44 100644
--- a/src/libstd/sys/windows/os_str.rs
+++ b/src/libstd/sys/windows/os_str.rs
@@ -159,6 +159,10 @@ impl Slice {
         Buf { inner: buf }
     }
 
+    pub fn clone_into(&self, buf: &mut Buf) {
+        self.inner.clone_into(&mut buf.inner)
+    }
+
     #[inline]
     pub fn into_box(&self) -> Box<Slice> {
         unsafe { mem::transmute(self.inner.into_box()) }