Mark unix::ffi::OsStrExt methods as inline

This commit is contained in:
Konrad Borowski 2019-04-04 10:51:18 +02:00
parent f717b58dd7
commit a37c33b926
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
}