@@ -3,7 +3,7 @@ use crate::co_alloc::CoAllocPref;
3
3
use core:: marker:: PhantomData ;
4
4
use core:: mem:: { self , SizedTypeProperties } ;
5
5
use core:: ptr:: NonNull ;
6
- use core:: { alloc , fmt, ptr} ;
6
+ use core:: { fmt, ptr} ;
7
7
8
8
use crate :: alloc:: { Allocator , Global } ;
9
9
@@ -21,9 +21,9 @@ pub struct Drain<
21
21
' a ,
22
22
T : ' a ,
23
23
#[ unstable( feature = "allocator_api" , issue = "32838" ) ] A : Allocator = Global ,
24
- const CO_ALLOC_PREF : CoAllocPref = { SHORT_TERM_VEC_PREFERS_COOP ! ( ) } ,
24
+ const CO_ALLOC_PREF : CoAllocPref = { SHORT_TERM_VEC_CO_ALLOC_PREF ! ( ) } ,
25
25
> where
26
- [ ( ) ; alloc :: co_alloc_metadata_num_slots_with_preference :: < A > ( CO_ALLOC_PREF ) ] : ,
26
+ [ ( ) ; { crate :: meta_num_slots! ( A , CO_ALLOC_PREF ) } ] : ,
27
27
{
28
28
// We can't just use a &mut VecDeque<T, A>, as that would make Drain invariant over T
29
29
// and we want it to be covariant instead
@@ -39,9 +39,10 @@ pub struct Drain<
39
39
_marker : PhantomData < & ' a T > ,
40
40
}
41
41
42
+ #[ allow( unused_braces) ]
42
43
impl < ' a , T , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > Drain < ' a , T , A , CO_ALLOC_PREF >
43
44
where
44
- [ ( ) ; alloc :: co_alloc_metadata_num_slots_with_preference :: < A > ( CO_ALLOC_PREF ) ] : ,
45
+ [ ( ) ; { crate :: meta_num_slots! ( A , CO_ALLOC_PREF ) } ] : ,
45
46
{
46
47
pub ( super ) unsafe fn new (
47
48
deque : & ' a mut VecDeque < T , A , CO_ALLOC_PREF > ,
96
97
}
97
98
98
99
#[ stable( feature = "collection_debug" , since = "1.17.0" ) ]
100
+ #[ allow( unused_braces) ]
99
101
impl < T : fmt:: Debug , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > fmt:: Debug for Drain < ' _ , T , A , CO_ALLOC_PREF >
100
102
where
101
- [ ( ) ; alloc :: co_alloc_metadata_num_slots_with_preference :: < A > ( CO_ALLOC_PREF ) ] : ,
103
+ [ ( ) ; { crate :: meta_num_slots! ( A , CO_ALLOC_PREF ) } ] : ,
102
104
{
103
105
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
104
106
f. debug_tuple ( "Drain" )
@@ -111,31 +113,34 @@ where
111
113
}
112
114
113
115
#[ stable( feature = "drain" , since = "1.6.0" ) ]
116
+ #[ allow( unused_braces) ]
114
117
unsafe impl < T : Sync , A : Allocator + Sync , const CO_ALLOC_PREF : CoAllocPref > Sync for Drain < ' _ , T , A , CO_ALLOC_PREF > where
115
- [ ( ) ; alloc :: co_alloc_metadata_num_slots_with_preference :: < A > ( CO_ALLOC_PREF ) ] :
118
+ [ ( ) ; { crate :: meta_num_slots! ( A , CO_ALLOC_PREF ) } ] :
116
119
{
117
120
}
118
121
#[ stable( feature = "drain" , since = "1.6.0" ) ]
122
+ #[ allow( unused_braces) ]
119
123
unsafe impl < T : Send , A : Allocator + Send , const CO_ALLOC_PREF : CoAllocPref > Send for Drain < ' _ , T , A , CO_ALLOC_PREF > where
120
- [ ( ) ; alloc :: co_alloc_metadata_num_slots_with_preference :: < A > ( CO_ALLOC_PREF ) ] :
124
+ [ ( ) ; { crate :: meta_num_slots! ( A , CO_ALLOC_PREF ) } ] :
121
125
{
122
126
}
123
127
124
128
#[ stable( feature = "drain" , since = "1.6.0" ) ]
129
+ #[ allow( unused_braces) ]
125
130
impl < T , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > Drop for Drain < ' _ , T , A , CO_ALLOC_PREF >
126
131
where
127
- [ ( ) ; alloc :: co_alloc_metadata_num_slots_with_preference :: < A > ( CO_ALLOC_PREF ) ] : ,
132
+ [ ( ) ; { crate :: meta_num_slots! ( A , CO_ALLOC_PREF ) } ] : ,
128
133
{
129
134
fn drop ( & mut self ) {
130
135
struct DropGuard < ' r , ' a , T , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > (
131
136
& ' r mut Drain < ' a , T , A , CO_ALLOC_PREF > ,
132
137
)
133
138
where
134
- [ ( ) ; alloc :: co_alloc_metadata_num_slots_with_preference :: < A > ( CO_ALLOC_PREF ) ] : ;
139
+ [ ( ) ; { crate :: meta_num_slots! ( A , CO_ALLOC_PREF ) } ] : ;
135
140
136
141
impl < ' r , ' a , T , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > Drop for DropGuard < ' r , ' a , T , A , CO_ALLOC_PREF >
137
142
where
138
- [ ( ) ; alloc :: co_alloc_metadata_num_slots_with_preference :: < A > ( CO_ALLOC_PREF ) ] : ,
143
+ [ ( ) ; { crate :: meta_num_slots! ( A , CO_ALLOC_PREF ) } ] : ,
139
144
{
140
145
fn drop ( & mut self ) {
141
146
if self . 0 . remaining != 0 {
@@ -217,9 +222,10 @@ where
217
222
}
218
223
219
224
#[ stable( feature = "drain" , since = "1.6.0" ) ]
225
+ #[ allow( unused_braces) ]
220
226
impl < T , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > Iterator for Drain < ' _ , T , A , CO_ALLOC_PREF >
221
227
where
222
- [ ( ) ; alloc :: co_alloc_metadata_num_slots_with_preference :: < A > ( CO_ALLOC_PREF ) ] : ,
228
+ [ ( ) ; { crate :: meta_num_slots! ( A , CO_ALLOC_PREF ) } ] : ,
223
229
{
224
230
type Item = T ;
225
231
@@ -242,9 +248,10 @@ where
242
248
}
243
249
244
250
#[ stable( feature = "drain" , since = "1.6.0" ) ]
251
+ #[ allow( unused_braces) ]
245
252
impl < T , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > DoubleEndedIterator for Drain < ' _ , T , A , CO_ALLOC_PREF >
246
253
where
247
- [ ( ) ; alloc :: co_alloc_metadata_num_slots_with_preference :: < A > ( CO_ALLOC_PREF ) ] : ,
254
+ [ ( ) ; { crate :: meta_num_slots! ( A , CO_ALLOC_PREF ) } ] : ,
248
255
{
249
256
#[ inline]
250
257
fn next_back ( & mut self ) -> Option < T > {
@@ -258,13 +265,15 @@ where
258
265
}
259
266
260
267
#[ stable( feature = "drain" , since = "1.6.0" ) ]
268
+ #[ allow( unused_braces) ]
261
269
impl < T , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > ExactSizeIterator for Drain < ' _ , T , A , CO_ALLOC_PREF > where
262
- [ ( ) ; alloc :: co_alloc_metadata_num_slots_with_preference :: < A > ( CO_ALLOC_PREF ) ] :
270
+ [ ( ) ; { crate :: meta_num_slots! ( A , CO_ALLOC_PREF ) } ] :
263
271
{
264
272
}
265
273
266
274
#[ stable( feature = "fused" , since = "1.26.0" ) ]
275
+ #[ allow( unused_braces) ]
267
276
impl < T , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > FusedIterator for Drain < ' _ , T , A , CO_ALLOC_PREF > where
268
- [ ( ) ; alloc :: co_alloc_metadata_num_slots_with_preference :: < A > ( CO_ALLOC_PREF ) ] :
277
+ [ ( ) ; { crate :: meta_num_slots! ( A , CO_ALLOC_PREF ) } ] :
269
278
{
270
279
}
0 commit comments