@@ -392,7 +392,7 @@ impl<T, A: Allocator> RawVec<T, A> {
392
392
// Size of allocator's per-allocation overhead we expect
393
393
// FIXME: maybe two pointers to be on the safe side? It could potentially
394
394
// be platform-dependent.
395
- let alloc_overhead_size = mem:: size_of :: < usize > ( ) ;
395
+ const ALLOC_OVERHEAD_SIZE : usize = mem:: size_of :: < usize > ( ) ;
396
396
397
397
// Nothing we can really do about these checks, sadly.
398
398
let required_cap = len. checked_add ( additional) . ok_or ( CapacityOverflow ) ?;
@@ -401,7 +401,7 @@ impl<T, A: Allocator> RawVec<T, A> {
401
401
. checked_mul ( mem:: size_of :: < T > ( ) )
402
402
. and_then (
403
403
// Add the overhead
404
- |alloc_size| alloc_size. checked_add ( alloc_overhead_size ) ,
404
+ |alloc_size| alloc_size. checked_add ( ALLOC_OVERHEAD_SIZE ) ,
405
405
)
406
406
. filter ( |alloc_size| * alloc_size < isize:: MAX as usize )
407
407
{
@@ -414,7 +414,7 @@ impl<T, A: Allocator> RawVec<T, A> {
414
414
// Leave some room for allocators that add fixed overhead (usually
415
415
// one pointer-size)
416
416
// `bin_size - ...` can't underflow, because alloc_overhead_size was already added
417
- let aligned_alloc_size = bin_size - ( alloc_overhead_size - 1 ) /* the +1 skipped from the previous line turned into -1 here */ ;
417
+ let aligned_alloc_size = bin_size - ( ALLOC_OVERHEAD_SIZE - 1 ) /* the +1 skipped from the previous line turned into -1 here */ ;
418
418
419
419
// Align the capacity to fit the bin
420
420
aligned_alloc_size / mem:: size_of :: < T > ( )
0 commit comments