diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 1407fe2771553..b480581e21ba9 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -250,6 +250,7 @@ impl From for Box { /// assert!( /// mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` + #[inline] fn from(err: String) -> Box { struct StringError(String); @@ -317,6 +318,7 @@ impl<'a> From<&str> for Box { /// assert!( /// mem::size_of::>() == mem::size_of_val(&a_boxed_error)) /// ``` + #[inline] fn from(err: &str) -> Box { From::from(String::from(err)) } diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 4c308327b83b7..77da97219b147 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -615,6 +615,7 @@ impl OsStr { /// assert!(!os_str.is_empty()); /// ``` #[stable(feature = "osstring_simple_functions", since = "1.9.0")] + #[inline] pub fn is_empty(&self) -> bool { self.inner.inner.is_empty() } @@ -965,6 +966,7 @@ impl AsRef for OsStr { #[stable(feature = "rust1", since = "1.0.0")] impl AsRef for OsString { + #[inline] fn as_ref(&self) -> &OsStr { self } diff --git a/src/libstd/path.rs b/src/libstd/path.rs index fbbdc1ddac297..a703cb748e06b 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1475,6 +1475,7 @@ impl From for PathBuf { /// Converts a `OsString` into a `PathBuf` /// /// This conversion does not allocate or copy memory. + #[inline] fn from(s: OsString) -> PathBuf { PathBuf { inner: s } } @@ -1535,7 +1536,7 @@ impl fmt::Debug for PathBuf { #[stable(feature = "rust1", since = "1.0.0")] impl ops::Deref for PathBuf { type Target = Path; - + #[inline] fn deref(&self) -> &Path { Path::new(&self.inner) } @@ -2655,6 +2656,7 @@ impl AsRef for OsString { #[stable(feature = "rust1", since = "1.0.0")] impl AsRef for str { + #[inline] fn as_ref(&self) -> &Path { Path::new(self) } @@ -2669,6 +2671,7 @@ impl AsRef for String { #[stable(feature = "rust1", since = "1.0.0")] impl AsRef for PathBuf { + #[inline] fn as_ref(&self) -> &Path { self } diff --git a/src/libstd/sys_common/os_str_bytes.rs b/src/libstd/sys_common/os_str_bytes.rs index eb8a881ec8881..e965ea79aa039 100644 --- a/src/libstd/sys_common/os_str_bytes.rs +++ b/src/libstd/sys_common/os_str_bytes.rs @@ -104,6 +104,7 @@ impl Buf { self.inner.shrink_to(min_capacity) } + #[inline] pub fn as_slice(&self) -> &Slice { unsafe { mem::transmute(&*self.inner) } }