Skip to content

Commit 48c24dd

Browse files
committed
Inline Id's deref and deref_mut
1 parent 9711e27 commit 48c24dd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

objc2/src/rc/id.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,8 @@ impl<T, O: Ownership> Deref for Id<T, O> {
379379
type Target = T;
380380

381381
/// Obtain an immutable reference to the object.
382+
// Box doesn't inline, but that's because it's a compiler built-in
383+
#[inline]
382384
fn deref(&self) -> &T {
383385
// SAFETY: The pointer's validity is verified when the type is created
384386
unsafe { self.ptr.as_ref() }
@@ -387,6 +389,7 @@ impl<T, O: Ownership> Deref for Id<T, O> {
387389

388390
impl<T> DerefMut for Id<T, Owned> {
389391
/// Obtain a mutable reference to the object.
392+
#[inline]
390393
fn deref_mut(&mut self) -> &mut T {
391394
// SAFETY: The pointer's validity is verified when the type is created
392395
// Additionally, the owned `Id` is the unique owner of the object, so

0 commit comments

Comments
 (0)