Add inline attr to private CString::into_inner

This commit is contained in:
Elichai Turkel 2021-05-26 13:12:54 +03:00
parent cdbe288897
commit 45099e6cf6

View File

@ -672,6 +672,7 @@ impl CString {
}
/// Bypass "move out of struct which implements [`Drop`] trait" restriction.
#[inline]
fn into_inner(self) -> Box<[u8]> {
// Rationale: `mem::forget(self)` invalidates the previous call to `ptr::read(&self.inner)`
// so we use `ManuallyDrop` to ensure `self` is not dropped.