FIX: Adjust (mostly remove) inline directives
Using the following principles: - Trivial methods (empty and simple constants) can be inline(always) - Generic methods don't need any inlining directive at all. ..with the exception of Deref which just seems to be extra important. - Non-generic items use #[inline] to enable inlining at the compiler's discretion.
This commit is contained in:
+1
-13
@@ -134,7 +134,7 @@ impl<A: Array> ArrayVec<A> {
|
||||
/// 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<A: Array> ArrayVec<A> {
|
||||
///
|
||||
/// 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<A: Array> ArrayVec<A> {
|
||||
///
|
||||
/// 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<A: Array> {
|
||||
impl<A: Array> Iterator for IntoIter<A> {
|
||||
type Item = A::Item;
|
||||
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<A::Item> {
|
||||
if self.index == self.v.len {
|
||||
None
|
||||
@@ -775,7 +772,6 @@ impl<A: Array> Iterator for IntoIter<A> {
|
||||
}
|
||||
|
||||
impl<A: Array> DoubleEndedIterator for IntoIter<A> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<A::Item> {
|
||||
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::Item> {
|
||||
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<usize>) {
|
||||
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::Item> {
|
||||
self.iter.next_back().map(|elt|
|
||||
unsafe {
|
||||
@@ -1069,27 +1062,22 @@ impl<A: Array> Default for ArrayVec<A> {
|
||||
}
|
||||
|
||||
impl<A: Array> PartialOrd for ArrayVec<A> where A::Item: PartialOrd {
|
||||
#[inline]
|
||||
fn partial_cmp(&self, other: &ArrayVec<A>) -> Option<cmp::Ordering> {
|
||||
(**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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user