From 0a7a0ff4d95cad91313ef53238ac28cc48a2a6b4 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Mon, 30 May 2022 15:11:53 +0100 Subject: [PATCH] Add `#[inline]` to `Vec`'s `Deref/DerefMut` --- library/alloc/src/vec/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index c157aba83c2..7c0d9fe288a 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -2493,6 +2493,7 @@ impl ExtendFromWithinSpec for Vec { impl ops::Deref for Vec { type Target = [T]; + #[inline] fn deref(&self) -> &[T] { unsafe { slice::from_raw_parts(self.as_ptr(), self.len) } } @@ -2500,6 +2501,7 @@ impl ops::Deref for Vec { #[stable(feature = "rust1", since = "1.0.0")] impl ops::DerefMut for Vec { + #[inline] fn deref_mut(&mut self) -> &mut [T] { unsafe { slice::from_raw_parts_mut(self.as_mut_ptr(), self.len) } }