diff --git a/src/array.rs b/src/array.rs index 6fab7ea..96a8bfd 100644 --- a/src/array.rs +++ b/src/array.rs @@ -87,10 +87,8 @@ macro_rules! fix_array_impl { type Index = $index_type; const CAPACITY: usize = $len; #[doc(hidden)] - #[inline] fn as_slice(&self) -> &[Self::Item] { self } #[doc(hidden)] - #[inline] fn as_mut_slice(&mut self) -> &mut [Self::Item] { self } } ) diff --git a/src/array_string.rs b/src/array_string.rs index 66e54c7..c1154c3 100644 --- a/src/array_string.rs +++ b/src/array_string.rs @@ -113,7 +113,7 @@ impl ArrayString /// let string = ArrayString::<[_; 3]>::new(); /// assert_eq!(string.capacity(), 3); /// ``` - #[inline] + #[inline(always)] pub fn capacity(&self) -> usize { A::CAPACITY } /// Return if the `ArrayString` is completely filled. @@ -244,7 +244,6 @@ impl ArrayString /// /// assert_eq!(s.pop(), None); /// ``` - #[inline] pub fn pop(&mut self) -> Option { let ch = match self.chars().rev().next() { Some(ch) => ch, @@ -273,7 +272,6 @@ impl ArrayString /// string.truncate(4); /// assert_eq!(&string[..], "foo"); /// ``` - #[inline] pub fn truncate(&mut self, new_len: usize) { if new_len <= self.len() { assert!(self.is_char_boundary(new_len)); @@ -304,7 +302,6 @@ impl ArrayString /// assert_eq!(s.remove(1), 'o'); /// assert_eq!(s.remove(0), 'o'); /// ``` - #[inline] pub fn remove(&mut self, idx: usize) -> char { let ch = match self[idx..].chars().next() { Some(ch) => ch, @@ -336,7 +333,6 @@ impl ArrayString /// /// This method uses *debug assertions* to check the validity of `length` /// and may use other debug assertions. - #[inline] pub unsafe fn set_len(&mut self, length: usize) { debug_assert!(length <= self.capacity()); self.len = Index::from(length); diff --git a/src/lib.rs b/src/lib.rs index 0086307..e335e5f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -134,7 +134,7 @@ impl ArrayVec { /// let array = ArrayVec::from([1, 2, 3]); /// assert_eq!(array.capacity(), 3); /// ``` - #[inline] + #[inline(always)] pub fn capacity(&self) -> usize { A::CAPACITY } /// Return if the `ArrayVec` is completely filled. @@ -235,7 +235,6 @@ impl ArrayVec { /// /// assert_eq!(&array[..], &[1, 2]); /// ``` - #[inline] pub unsafe fn push_unchecked(&mut self, element: A::Item) { let len = self.len(); debug_assert!(len < A::CAPACITY); @@ -507,7 +506,6 @@ impl ArrayVec { /// /// This method uses *debug assertions* to check that `length` is /// not greater than the capacity. - #[inline] pub unsafe fn set_len(&mut self, length: usize) { debug_assert!(length <= self.capacity()); self.len = Index::from(length); @@ -755,7 +753,6 @@ pub struct IntoIter { impl Iterator for IntoIter { type Item = A::Item; - #[inline] fn next(&mut self) -> Option { if self.index == self.v.len { None @@ -775,7 +772,6 @@ impl Iterator for IntoIter { } impl DoubleEndedIterator for IntoIter { - #[inline] fn next_back(&mut self) -> Option { if self.index == self.v.len { None @@ -852,7 +848,6 @@ impl<'a, A: Array> Iterator for Drain<'a, A> { type Item = A::Item; - #[inline] fn next(&mut self) -> Option { self.iter.next().map(|elt| unsafe { @@ -861,7 +856,6 @@ impl<'a, A: Array> Iterator for Drain<'a, A> ) } - #[inline] fn size_hint(&self) -> (usize, Option) { self.iter.size_hint() } @@ -870,7 +864,6 @@ impl<'a, A: Array> Iterator for Drain<'a, A> impl<'a, A: Array> DoubleEndedIterator for Drain<'a, A> where A::Item: 'a, { - #[inline] fn next_back(&mut self) -> Option { self.iter.next_back().map(|elt| unsafe { @@ -1069,27 +1062,22 @@ impl Default for ArrayVec { } impl PartialOrd for ArrayVec where A::Item: PartialOrd { - #[inline] fn partial_cmp(&self, other: &ArrayVec) -> Option { (**self).partial_cmp(other) } - #[inline] fn lt(&self, other: &Self) -> bool { (**self).lt(other) } - #[inline] fn le(&self, other: &Self) -> bool { (**self).le(other) } - #[inline] fn ge(&self, other: &Self) -> bool { (**self).ge(other) } - #[inline] fn gt(&self, other: &Self) -> bool { (**self).gt(other) }