Inline to make OsStr::is_empty zero cost

This commit is contained in:
Lzu Tao 2020-01-10 18:20:40 +00:00
parent f795e8a216
commit 137a31d692
2 changed files with 2 additions and 0 deletions

View File

@ -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()
}

View File

@ -104,6 +104,7 @@ impl Buf {
self.inner.shrink_to(min_capacity)
}
#[inline]
pub fn as_slice(&self) -> &Slice {
unsafe { mem::transmute(&*self.inner) }
}