Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add #[inline] attribute to all fns which return SmallVec #206

Merged
merged 1 commit into from Apr 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib.rs
Expand Up @@ -1055,6 +1055,7 @@ impl<A: Array> SmallVec<A> {
/// assert_eq!(&*rebuilt, &[4, 5, 6]);
/// }
/// }
#[inline]
pub unsafe fn from_raw_parts(ptr: *mut A::Item, length: usize, capacity: usize) -> SmallVec<A> {
assert!(capacity > A::size());
SmallVec {
Expand Down Expand Up @@ -1372,6 +1373,7 @@ where
}

impl<A: Array> FromIterator<A::Item> for SmallVec<A> {
#[inline]
fn from_iter<I: IntoIterator<Item = A::Item>>(iterable: I) -> SmallVec<A> {
let mut v = SmallVec::new();
v.extend(iterable);
Expand Down Expand Up @@ -1452,6 +1454,7 @@ impl<A: Array> Clone for SmallVec<A>
where
A::Item: Clone,
{
#[inline]
fn clone(&self) -> SmallVec<A> {
let mut new_vector = SmallVec::with_capacity(self.len());
for element in self.iter() {
Expand Down Expand Up @@ -1700,6 +1703,7 @@ trait ToSmallVec<A:Array> {

impl<A:Array> ToSmallVec<A> for [A::Item]
where A::Item: Copy {
#[inline]
fn to_smallvec(&self) -> SmallVec<A> {
SmallVec::from_slice(self)
}
Expand Down