Skip to content

Commit

Permalink
Inline to make OsStr::is_empty zero cost
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jan 10, 2020
1 parent f795e8a commit 137a31d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/libstd/ffi/os_str.rs
Expand Up @@ -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()
}
Expand Down
1 change: 1 addition & 0 deletions src/libstd/sys_common/os_str_bytes.rs
Expand Up @@ -104,6 +104,7 @@ impl Buf {
self.inner.shrink_to(min_capacity)
}

#[inline]
pub fn as_slice(&self) -> &Slice {
unsafe { mem::transmute(&*self.inner) }
}
Expand Down

0 comments on commit 137a31d

Please sign in to comment.