@@ -636,49 +636,45 @@ impl<'a> TraitDef<'a> {
636636 }
637637 } ) ) ;
638638
639- {
640- // Extra scope required here so ty_params goes out of scope before params is moved
641-
642- let mut ty_params = params
643- . iter ( )
644- . filter ( |param| matches ! ( param. kind, ast:: GenericParamKind :: Type { .. } ) )
645- . peekable ( ) ;
646-
647- if ty_params. peek ( ) . is_some ( ) {
648- let ty_param_names: Vec < Symbol > =
649- ty_params. map ( |ty_param| ty_param. ident . name ) . collect ( ) ;
650-
651- for field_ty in field_tys {
652- let field_ty_params = find_type_parameters ( & field_ty, & ty_param_names, cx) ;
653-
654- for field_ty_param in field_ty_params {
655- // if we have already handled this type, skip it
656- if let ast:: TyKind :: Path ( _, ref p) = field_ty_param. ty . kind {
657- if p. segments . len ( ) == 1
658- && ty_param_names. contains ( & p. segments [ 0 ] . ident . name )
659- {
660- continue ;
661- } ;
662- }
663- let mut bounds: Vec < _ > = self
664- . additional_bounds
665- . iter ( )
666- . map ( |p| cx. trait_bound ( p. to_path ( cx, self . span , type_ident, generics) ) )
667- . collect ( ) ;
639+ let mut ty_params = params
640+ . iter ( )
641+ . filter ( |param| matches ! ( param. kind, ast:: GenericParamKind :: Type { .. } ) )
642+ . peekable ( ) ;
643+
644+ if ty_params. peek ( ) . is_some ( ) {
645+ let ty_param_names: Vec < Symbol > =
646+ ty_params. map ( |ty_param| ty_param. ident . name ) . collect ( ) ;
647+
648+ for field_ty in field_tys {
649+ let field_ty_params = find_type_parameters ( & field_ty, & ty_param_names, cx) ;
650+
651+ for field_ty_param in field_ty_params {
652+ // if we have already handled this type, skip it
653+ if let ast:: TyKind :: Path ( _, ref p) = field_ty_param. ty . kind {
654+ if p. segments . len ( ) == 1
655+ && ty_param_names. contains ( & p. segments [ 0 ] . ident . name )
656+ {
657+ continue ;
658+ } ;
659+ }
660+ let mut bounds: Vec < _ > = self
661+ . additional_bounds
662+ . iter ( )
663+ . map ( |p| cx. trait_bound ( p. to_path ( cx, self . span , type_ident, generics) ) )
664+ . collect ( ) ;
668665
669- // require the current trait
670- bounds. push ( cx. trait_bound ( trait_path. clone ( ) ) ) ;
666+ // require the current trait
667+ bounds. push ( cx. trait_bound ( trait_path. clone ( ) ) ) ;
671668
672- let predicate = ast:: WhereBoundPredicate {
673- span : self . span ,
674- bound_generic_params : field_ty_param. bound_generic_params ,
675- bounded_ty : field_ty_param. ty ,
676- bounds,
677- } ;
669+ let predicate = ast:: WhereBoundPredicate {
670+ span : self . span ,
671+ bound_generic_params : field_ty_param. bound_generic_params ,
672+ bounded_ty : field_ty_param. ty ,
673+ bounds,
674+ } ;
678675
679- let predicate = ast:: WherePredicate :: BoundPredicate ( predicate) ;
680- where_clause. predicates . push ( predicate) ;
681- }
676+ let predicate = ast:: WherePredicate :: BoundPredicate ( predicate) ;
677+ where_clause. predicates . push ( predicate) ;
682678 }
683679 }
684680 }
0 commit comments