@@ -623,10 +623,7 @@ impl<T: TransparentType> Slice<T> {
623
623
MIN_SIZE / mem:: size_of :: < T > ( ) ,
624
624
) ) ;
625
625
assert_ne ! ( new_capacity, 0 ) ;
626
-
627
- if new_capacity <= self . capacity {
628
- return ;
629
- }
626
+ assert ! ( new_capacity > self . capacity) ;
630
627
631
628
unsafe {
632
629
let ptr = if self . capacity == 0 {
@@ -688,7 +685,7 @@ impl<T: TransparentType> Slice<T> {
688
685
#[ inline]
689
686
pub fn extend_from_slice ( & mut self , other : & [ T ] ) {
690
687
// Nothing new to reserve as there's still enough space
691
- if self . len + other. len ( ) <= self . capacity {
688
+ if self . len + other. len ( ) > self . capacity {
692
689
self . reserve ( other. len ( ) ) ;
693
690
}
694
691
@@ -709,7 +706,7 @@ impl<T: TransparentType> Slice<T> {
709
706
assert ! ( index <= self . len) ;
710
707
711
708
// Nothing new to reserve as there's still enough space
712
- if self . len + 1 <= self . capacity {
709
+ if self . len + 1 > self . capacity {
713
710
self . reserve ( 1 ) ;
714
711
}
715
712
@@ -732,7 +729,7 @@ impl<T: TransparentType> Slice<T> {
732
729
#[ allow( clippy:: int_plus_one) ]
733
730
pub fn push ( & mut self , item : T ) {
734
731
// Nothing new to reserve as there's still enough space
735
- if self . len + 1 <= self . capacity {
732
+ if self . len + 1 > self . capacity {
736
733
self . reserve ( 1 ) ;
737
734
}
738
735
0 commit comments