@@ -8,7 +8,8 @@ mod macros;
88use core:: mem:: MaybeUninit ;
99use core:: { cmp, error, fmt, slice} ;
1010
11- /// Error for when the vector is full or the requested operation would need more space than the capacity.
11+ /// Error for when the vector is full or the requested operation would need more space than the
12+ /// capacity.
1213///
1314/// See [`Vec::push()`] example for usage.
1415#[ derive( Debug ) ]
@@ -131,7 +132,6 @@ impl<T, const CAPACITY: usize> Vec<T, CAPACITY> {
131132
132133 /// Returns whether the vector is at maximum capacity.
133134 ///
134- ///
135135 /// # Example
136136 ///
137137 /// ```rust
@@ -225,8 +225,8 @@ impl<T, const CAPACITY: usize> Vec<T, CAPACITY> {
225225 ///
226226 /// # Requirements
227227 ///
228- /// - `T` must implement [`Default`] because new elements are created with `T::default()`
229- /// when increasing the length.
228+ /// - `T` must implement [`Default`] because new elements are created with `T::default()` when
229+ /// increasing the length.
230230 ///
231231 /// # Errors
232232 ///
@@ -310,7 +310,8 @@ impl<T, const CAPACITY: usize> Vec<T, CAPACITY> {
310310 self . get ( 0 )
311311 }
312312
313- /// Returns a mutable reference to the first element in the vector, or [`None`] if the vector is empty.
313+ /// Returns a mutable reference to the first element in the vector, or [`None`] if the vector is
314+ /// empty.
314315 ///
315316 /// # Example
316317 ///
@@ -352,7 +353,8 @@ impl<T, const CAPACITY: usize> Vec<T, CAPACITY> {
352353 if self . is_empty ( ) { None } else { self . get ( self . len ( ) - 1 ) }
353354 }
354355
355- /// Returns a mutable reference to the last element in the vector, or [`None`] if the vector is empty.
356+ /// Returns a mutable reference to the last element in the vector, or [`None`] if the vector is
357+ /// empty.
356358 ///
357359 /// # Example
358360 ///
@@ -405,7 +407,8 @@ impl<T, const CAPACITY: usize> Vec<T, CAPACITY> {
405407 }
406408 }
407409
408- /// Returns a mutable reference to the element at the specified `index`, or [`None`] if out of bounds.
410+ /// Returns a mutable reference to the element at the specified `index`, or [`None`] if out of
411+ /// bounds.
409412 ///
410413 /// # Example
411414 ///
@@ -475,8 +478,9 @@ impl<T, const CAPACITY: usize> Vec<T, CAPACITY> {
475478 }
476479 }
477480
478- /// Returns (and removes) the last element from the vector if the predicate returns true,
479- /// or [`None`] if the vector is empty or the predicate returns false.
481+ /// Returns (and removes) the last element from the vector if the predicate returns true, or
482+ /// [`None`] if the vector is empty or the predicate returns false.
483+ ///
480484 /// # Example
481485 ///
482486 /// Similar to [`Vec::pop()`], but needs a predicate
@@ -591,7 +595,8 @@ impl<T, const CAPACITY: usize> Vec<T, CAPACITY> {
591595 ///
592596 /// # Errors
593597 ///
594- /// Returns [`CapacityError`] if adding elements of given slice would result in vector exceeding its capacity.
598+ /// Returns [`CapacityError`] if adding elements of given slice would result in vector exceeding
599+ /// its capacity.
595600 ///
596601 /// # Example
597602 ///
@@ -645,7 +650,8 @@ impl<T, const CAPACITY: usize> Vec<T, CAPACITY> {
645650 ///
646651 /// # Errors
647652 ///
648- /// Returns [`CapacityError`] if adding elements from `other` would result in current vector exceeding its capacity.
653+ /// Returns [`CapacityError`] if adding elements from `other` would result in current vector
654+ /// exceeding its capacity.
649655 ///
650656 /// # Example
651657 ///
@@ -688,8 +694,9 @@ impl<T, const CAPACITY: usize> Vec<T, CAPACITY> {
688694 self . length += 1 ;
689695 }
690696
691- /// Drops all elements in given range. Needed when elements are considered to be going out of scope.
692- /// E.g.: when the vector is going out of scope, when methods such as [`Vec::clear()`] and [`Vec::set_len()`] are called.
697+ /// Drops all elements in given range. Needed when elements are considered to be going out of
698+ /// scope. E.g.: when the vector is going out of scope, when methods such as
699+ /// [`Vec::clear()`] and [`Vec::set_len()`] are called.
693700 fn drop_range ( & mut self , from : usize , to : usize ) {
694701 for i in from..to {
695702 // SAFETY:
@@ -770,8 +777,8 @@ impl<'a, T> Iterator for Iter<'a, T> {
770777}
771778
772779impl < ' a , T : ' a , const CAPACITY : usize > IntoIterator for & ' a Vec < T , CAPACITY > {
773- type Item = & ' a T ;
774780 type IntoIter = Iter < ' a , T > ;
781+ type Item = & ' a T ;
775782
776783 fn into_iter ( self ) -> Self :: IntoIter {
777784 self . iter ( )
@@ -815,8 +822,8 @@ impl<'a, T> Iterator for IterMut<'a, T> {
815822}
816823
817824impl < ' a , T : ' a , const CAPACITY : usize > IntoIterator for & ' a mut Vec < T , CAPACITY > {
818- type Item = & ' a mut T ;
819825 type IntoIter = IterMut < ' a , T > ;
826+ type Item = & ' a mut T ;
820827
821828 fn into_iter ( self ) -> Self :: IntoIter {
822829 self . iter_mut ( )
0 commit comments