about summary refs log tree commit diff
path: root/src/libstd/ffi
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2020-03-20 15:46:40 -0700
committerJosh Stone <jistone@redhat.com>2020-04-06 18:26:37 -0700
commitf854070bb820501d88d1b029660bfde663595530 (patch)
tree834344f0f196a8aa8733510370c63201fc895fac /src/libstd/ffi
parentb80fa76ee0a160fffa04e337b8e33ef655a80649 (diff)
downloadrust-f854070bb820501d88d1b029660bfde663595530.tar.gz
rust-f854070bb820501d88d1b029660bfde663595530.zip
Forward OsStr::clone_into to the inner Vec
Despite OS differences, they're all just `Vec<u8>` inside, so we can
just forward `clone_into` calls to that optimized implementation.
Diffstat (limited to 'src/libstd/ffi')
-rw-r--r--src/libstd/ffi/os_str.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs
index 5e686946f8e..4fde3316973 100644
--- a/src/libstd/ffi/os_str.rs
+++ b/src/libstd/ffi/os_str.rs
@@ -1120,8 +1120,7 @@ impl ToOwned for OsStr {
         self.to_os_string()
     }
     fn clone_into(&self, target: &mut OsString) {
-        target.clear();
-        target.push(self);
+        self.inner.clone_into(&mut target.inner)
     }
 }