Rollup merge of #59690 - xfix:patch-17, r=cramertj

Mark unix::ffi::OsStrExt methods as inline

This is a small change, but I found it surprising it's not inlined looking at the assembly.
This commit is contained in:
Mazdak Farrokhzad 2019-04-05 12:46:51 +02:00 committed by GitHub
commit c392832195
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View file

@ -960,6 +960,7 @@ impl IntoInner<Buf> for OsString {
}
impl AsInner<Slice> for OsStr {
#[inline]
fn as_inner(&self) -> &Slice {
&self.inner
}

View file

@ -236,9 +236,11 @@ pub trait OsStrExt {
#[stable(feature = "rust1", since = "1.0.0")]
impl OsStrExt for OsStr {
#[inline]
fn from_bytes(slice: &[u8]) -> &OsStr {
unsafe { mem::transmute(slice) }
}
#[inline]
fn as_bytes(&self) -> &[u8] {
&self.as_inner().inner
}