summary refs log tree commit diff
path: root/library/alloc/src/collections
diff options
context:
space:
mode:
authorCai Bear <git@caibear.com>2024-03-23 21:27:59 -0700
committerCai Bear <git@caibear.com>2024-03-28 16:21:54 -0700
commit18d390883efc7eaf5ced77d89abc5b51c8b7f816 (patch)
tree486fc19f7b562890eb3f8fe8f96877e8e5324c13 /library/alloc/src/collections
parentba527200cce74e0b752927f5fd071d06fd9d0962 (diff)
downloadrust-18d390883efc7eaf5ced77d89abc5b51c8b7f816.tar.gz
rust-18d390883efc7eaf5ced77d89abc5b51c8b7f816.zip
Remove len argument from RawVec::reserve_for_push because it's always equal to capacity. Also make Vec::insert use reserve_for_push.
Diffstat (limited to 'library/alloc/src/collections')
-rw-r--r--library/alloc/src/collections/vec_deque/mod.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/library/alloc/src/collections/vec_deque/mod.rs b/library/alloc/src/collections/vec_deque/mod.rs
index 41adc2e79dc..742daea873e 100644
--- a/library/alloc/src/collections/vec_deque/mod.rs
+++ b/library/alloc/src/collections/vec_deque/mod.rs
@@ -2086,10 +2086,9 @@ impl<T, A: Allocator> VecDeque<T, A> {
         // Extend or possibly remove this assertion when valid use-cases for growing the
         // buffer without it being full emerge
         debug_assert!(self.is_full());
-        let old_cap = self.capacity();
-        self.buf.reserve_for_push(old_cap);
+        self.buf.reserve_for_push();
         unsafe {
-            self.handle_capacity_increase(old_cap);
+            self.handle_capacity_increase(self.capacity());
         }
         debug_assert!(!self.is_full());
     }