Skip to content

Commit dbfc34c

Browse files
committed
Add #[inline] to Vec's Deref/DerefMut
1 parent 1e8b29a commit dbfc34c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

alloc/src/vec/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2493,13 +2493,15 @@ impl<T: Copy, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
24932493
impl<T, A: Allocator> ops::Deref for Vec<T, A> {
24942494
type Target = [T];
24952495

2496+
#[inline]
24962497
fn deref(&self) -> &[T] {
24972498
unsafe { slice::from_raw_parts(self.as_ptr(), self.len) }
24982499
}
24992500
}
25002501

25012502
#[stable(feature = "rust1", since = "1.0.0")]
25022503
impl<T, A: Allocator> ops::DerefMut for Vec<T, A> {
2504+
#[inline]
25032505
fn deref_mut(&mut self) -> &mut [T] {
25042506
unsafe { slice::from_raw_parts_mut(self.as_mut_ptr(), self.len) }
25052507
}

0 commit comments

Comments
 (0)