@@ -14,7 +14,7 @@ use core::ops::Drop;
14
14
use core:: ptr:: { self , NonNull , Unique } ;
15
15
use core:: slice;
16
16
17
- use alloc:: { Alloc , Layout , Global } ;
17
+ use alloc:: { Alloc , Layout , Global , oom } ;
18
18
use alloc:: CollectionAllocErr ;
19
19
use alloc:: CollectionAllocErr :: * ;
20
20
use boxed:: Box ;
@@ -101,7 +101,7 @@ impl<T, A: Alloc> RawVec<T, A> {
101
101
} ;
102
102
match result {
103
103
Ok ( ptr) => ptr,
104
- Err ( _) => a . oom ( ) ,
104
+ Err ( _) => oom ( ) ,
105
105
}
106
106
} ;
107
107
@@ -316,7 +316,7 @@ impl<T, A: Alloc> RawVec<T, A> {
316
316
new_size) ;
317
317
match ptr_res {
318
318
Ok ( ptr) => ( new_cap, ptr. cast ( ) . into ( ) ) ,
319
- Err ( _) => self . a . oom ( ) ,
319
+ Err ( _) => oom ( ) ,
320
320
}
321
321
}
322
322
None => {
@@ -325,7 +325,7 @@ impl<T, A: Alloc> RawVec<T, A> {
325
325
let new_cap = if elem_size > ( !0 ) / 8 { 1 } else { 4 } ;
326
326
match self . a . alloc_array :: < T > ( new_cap) {
327
327
Ok ( ptr) => ( new_cap, ptr. into ( ) ) ,
328
- Err ( _) => self . a . oom ( ) ,
328
+ Err ( _) => oom ( ) ,
329
329
}
330
330
}
331
331
} ;
@@ -442,7 +442,7 @@ impl<T, A: Alloc> RawVec<T, A> {
442
442
pub fn reserve_exact ( & mut self , used_cap : usize , needed_extra_cap : usize ) {
443
443
match self . try_reserve_exact ( used_cap, needed_extra_cap) {
444
444
Err ( CapacityOverflow ) => capacity_overflow ( ) ,
445
- Err ( AllocErr ) => self . a . oom ( ) ,
445
+ Err ( AllocErr ) => oom ( ) ,
446
446
Ok ( ( ) ) => { /* yay */ }
447
447
}
448
448
}
@@ -552,7 +552,7 @@ impl<T, A: Alloc> RawVec<T, A> {
552
552
pub fn reserve ( & mut self , used_cap : usize , needed_extra_cap : usize ) {
553
553
match self . try_reserve ( used_cap, needed_extra_cap) {
554
554
Err ( CapacityOverflow ) => capacity_overflow ( ) ,
555
- Err ( AllocErr ) => self . a . oom ( ) ,
555
+ Err ( AllocErr ) => oom ( ) ,
556
556
Ok ( ( ) ) => { /* yay */ }
557
557
}
558
558
}
@@ -667,7 +667,7 @@ impl<T, A: Alloc> RawVec<T, A> {
667
667
old_layout,
668
668
new_size) {
669
669
Ok ( p) => self . ptr = p. cast ( ) . into ( ) ,
670
- Err ( _) => self . a . oom ( ) ,
670
+ Err ( _) => oom ( ) ,
671
671
}
672
672
}
673
673
self . cap = amount;
0 commit comments