From f5f6d89e7e96027ad4959ae2eab819393584a87b Mon Sep 17 00:00:00 2001 From: hiddenhare <43314166+hiddenhare@users.noreply.github.com> Date: Sat, 4 Apr 2020 11:37:58 +0100 Subject: [PATCH] Add #[inline] attribute to all fns which return SmallVec --- lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib.rs b/lib.rs index d3e6a71..c935894 100644 --- a/lib.rs +++ b/lib.rs @@ -1055,6 +1055,7 @@ impl SmallVec { /// assert_eq!(&*rebuilt, &[4, 5, 6]); /// } /// } + #[inline] pub unsafe fn from_raw_parts(ptr: *mut A::Item, length: usize, capacity: usize) -> SmallVec { assert!(capacity > A::size()); SmallVec { @@ -1372,6 +1373,7 @@ where } impl FromIterator for SmallVec { + #[inline] fn from_iter>(iterable: I) -> SmallVec { let mut v = SmallVec::new(); v.extend(iterable); @@ -1452,6 +1454,7 @@ impl Clone for SmallVec where A::Item: Clone, { + #[inline] fn clone(&self) -> SmallVec { let mut new_vector = SmallVec::with_capacity(self.len()); for element in self.iter() { @@ -1700,6 +1703,7 @@ trait ToSmallVec { impl ToSmallVec for [A::Item] where A::Item: Copy { + #[inline] fn to_smallvec(&self) -> SmallVec { SmallVec::from_slice(self) }