File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -309,10 +309,10 @@ impl<T> Vec<T> {
309
309
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
310
310
pub fn reserve ( & mut self , additional : usize ) {
311
311
if self . cap - self . len < additional {
312
- let err_msg = "Vec::reserve: `isize` overflow" ;
312
+ const ERR_MSG : & ' static str = "Vec::reserve: `isize` overflow" ;
313
313
314
- let new_min_cap = self . len . checked_add ( additional) . expect ( err_msg ) ;
315
- if new_min_cap > MAX_MEMORY_SIZE { panic ! ( err_msg ) }
314
+ let new_min_cap = self . len . checked_add ( additional) . expect ( ERR_MSG ) ;
315
+ if new_min_cap > MAX_MEMORY_SIZE { panic ! ( ERR_MSG ) }
316
316
self . grow_capacity ( match new_min_cap. checked_next_power_of_two ( ) {
317
317
Some ( x) if x > MAX_MEMORY_SIZE => MAX_MEMORY_SIZE ,
318
318
None => MAX_MEMORY_SIZE ,
You can’t perform that action at this time.
0 commit comments