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.
This commit is contained in:
parent
b80fa76ee0
commit
f854070bb8
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()) }
|
||||
|
@ -173,6 +173,10 @@ impl Slice {
|
||||
Buf { inner: self.inner.to_vec() }
|
||||
}
|
||||
|
||||
pub fn clone_into(&self, buf: &mut Buf) {
|
||||
self.inner.clone_into(&mut buf.inner)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn into_box(&self) -> Box<Slice> {
|
||||
let boxed: Box<[u8]> = self.inner.into();
|
||||
|
@ -613,6 +613,10 @@ impl Wtf8 {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn clone_into(&self, buf: &mut Wtf8Buf) {
|
||||
self.bytes.clone_into(&mut buf.bytes)
|
||||
}
|
||||
|
||||
/// Boxes this `Wtf8`.
|
||||
#[inline]
|
||||
pub fn into_box(&self) -> Box<Wtf8> {
|
||||
|
Loading…
Reference in New Issue
Block a user