From ab0f9b9fc201208753a0f79c5ed94a213f16ff67 Mon Sep 17 00:00:00 2001 From: Moulins Date: Wed, 5 Apr 2023 19:12:54 +0200 Subject: [PATCH] wstr: Inline more `WString` methods --- wstr/src/buf.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wstr/src/buf.rs b/wstr/src/buf.rs index e60e771ae..353286463 100644 --- a/wstr/src/buf.rs +++ b/wstr/src/buf.rs @@ -179,6 +179,7 @@ impl WString { } /// Converts this `WString` into a string slice. + #[inline] pub fn as_wstr(&self) -> &WStr { let wstr = ptr::from_raw_parts(self.data.as_ptr(), self.meta); // SAFETY:`self` is immutably borrowed. @@ -186,6 +187,7 @@ impl WString { } /// Converts this `WString` into a mutable string slice. + #[inline] pub fn as_wstr_mut(&mut self) -> &mut WStr { let wstr = ptr::from_raw_parts(self.data.as_ptr(), self.meta); // SAFETY:`self` is mutably borrowed. @@ -290,6 +292,7 @@ impl WString { } /// Truncates this `WString`, removing all contents. + #[inline] pub fn clear(&mut self) { // SAFETY: 0 is always a valid length. unsafe { @@ -372,6 +375,7 @@ impl WString { } impl Drop for WString { + #[inline] fn drop(&mut self) { // SAFETY: `self` is gone after this line. unsafe {