Skip to content

Commit 137a31d

Browse files
committed
Inline to make OsStr::is_empty zero cost
1 parent f795e8a commit 137a31d

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/libstd/ffi/os_str.rs

+1
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ impl OsStr {
615615
/// assert!(!os_str.is_empty());
616616
/// ```
617617
#[stable(feature = "osstring_simple_functions", since = "1.9.0")]
618+
#[inline]
618619
pub fn is_empty(&self) -> bool {
619620
self.inner.inner.is_empty()
620621
}

src/libstd/sys_common/os_str_bytes.rs

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ impl Buf {
104104
self.inner.shrink_to(min_capacity)
105105
}
106106

107+
#[inline]
107108
pub fn as_slice(&self) -> &Slice {
108109
unsafe { mem::transmute(&*self.inner) }
109110
}

0 commit comments

Comments
 (0)