diff options
| author | Josh Stone <jistone@redhat.com> | 2020-03-20 15:46:40 -0700 |
|---|---|---|
| committer | Josh Stone <jistone@redhat.com> | 2020-04-06 18:26:37 -0700 |
| commit | f854070bb820501d88d1b029660bfde663595530 (patch) | |
| tree | 834344f0f196a8aa8733510370c63201fc895fac /src/libstd/ffi | |
| parent | b80fa76ee0a160fffa04e337b8e33ef655a80649 (diff) | |
| download | rust-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.rs | 3 |
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) } } |
