1
Fork 0

Auto merge of #94372 - erikdesjardins:asrefinl, r=dtolnay

Add #[inline] to trivial AsRef/AsMut impls

These appeared uninlined in some perf runs, but they're trivial.

r? `@ghost`
This commit is contained in:
bors 2022-03-19 22:32:28 +00:00
commit f2661cfe34

View file

@ -487,6 +487,7 @@ impl<T: ?Sized, U: ?Sized> const AsRef<U> for &T
where where
T: ~const AsRef<U>, T: ~const AsRef<U>,
{ {
#[inline]
fn as_ref(&self) -> &U { fn as_ref(&self) -> &U {
<T as AsRef<U>>::as_ref(*self) <T as AsRef<U>>::as_ref(*self)
} }
@ -499,6 +500,7 @@ impl<T: ?Sized, U: ?Sized> const AsRef<U> for &mut T
where where
T: ~const AsRef<U>, T: ~const AsRef<U>,
{ {
#[inline]
fn as_ref(&self) -> &U { fn as_ref(&self) -> &U {
<T as AsRef<U>>::as_ref(*self) <T as AsRef<U>>::as_ref(*self)
} }
@ -519,6 +521,7 @@ impl<T: ?Sized, U: ?Sized> const AsMut<U> for &mut T
where where
T: ~const AsMut<U>, T: ~const AsMut<U>,
{ {
#[inline]
fn as_mut(&mut self) -> &mut U { fn as_mut(&mut self) -> &mut U {
(*self).as_mut() (*self).as_mut()
} }