From 18d390883efc7eaf5ced77d89abc5b51c8b7f816 Mon Sep 17 00:00:00 2001 From: Cai Bear Date: Sat, 23 Mar 2024 21:27:59 -0700 Subject: Remove len argument from RawVec::reserve_for_push because it's always equal to capacity. Also make Vec::insert use reserve_for_push. --- library/alloc/src/collections/vec_deque/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'library/alloc/src/collections') 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 VecDeque { // 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()); } -- cgit 1.4.1-3-g733a5