Add #[inline] to trivial AsRef impls

These appeared uninlined in some perf runs, but they're trivial.
This commit is contained in:
Erik Desjardins 2022-02-25 15:18:16 -05:00
parent 6cbc6c35e4
commit 4194d7537e

View File

@ -486,6 +486,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)
} }
@ -498,6 +499,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)
} }
@ -518,6 +520,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()
} }