@@ -213,14 +213,18 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
213
213
// If the type is parameterized by this region, then replace this
214
214
// region with the current anon region binding (in other words,
215
215
// whatever & would get replaced with).
216
- let mut lt_provided = 0 ;
217
- let mut ty_provided = 0 ;
218
- for arg in & generic_args. args {
219
- match arg {
220
- GenericArg :: Lifetime ( _) => lt_provided += 1 ,
221
- GenericArg :: Type ( _) => ty_provided += 1 ,
222
- }
223
- }
216
+
217
+ // FIXME(varkor): Separating out the parameters is messy.
218
+ let lifetimes: Vec < _ > = generic_args. args . iter ( ) . filter_map ( |arg| match arg {
219
+ GenericArg :: Lifetime ( lt) => Some ( lt) ,
220
+ _ => None ,
221
+ } ) . collect ( ) ;
222
+ let types: Vec < _ > = generic_args. args . iter ( ) . filter_map ( |arg| match arg {
223
+ GenericArg :: Type ( ty) => Some ( ty) ,
224
+ _ => None ,
225
+ } ) . collect ( ) ;
226
+ let lt_provided = lifetimes. len ( ) ;
227
+ let ty_provided = types. len ( ) ;
224
228
225
229
let decl_generics = tcx. generics_of ( def_id) ;
226
230
let mut lt_accepted = 0 ;
@@ -271,15 +275,6 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
271
275
} ;
272
276
273
277
let own_self = self_ty. is_some ( ) as usize ;
274
- // FIXME(varkor): Separating out the parameters is messy.
275
- let lifetimes: Vec < _ > = generic_args. args . iter ( ) . filter_map ( |arg| match arg {
276
- GenericArg :: Lifetime ( lt) => Some ( lt) ,
277
- _ => None ,
278
- } ) . collect ( ) ;
279
- let types: Vec < _ > = generic_args. args . iter ( ) . filter_map ( |arg| match arg {
280
- GenericArg :: Type ( ty) => Some ( ty) ,
281
- _ => None ,
282
- } ) . collect ( ) ;
283
278
let substs = Substs :: for_item ( tcx, def_id, |param, substs| {
284
279
match param. kind {
285
280
GenericParamDefKind :: Lifetime => {
0 commit comments