@@ -102,9 +102,9 @@ impl TraitBounds {
102102impl_lint_pass ! ( TraitBounds => [ TYPE_REPETITION_IN_BOUNDS , TRAIT_DUPLICATION_IN_BOUNDS ] ) ;
103103
104104impl < ' tcx > LateLintPass < ' tcx > for TraitBounds {
105- fn check_generics ( & mut self , cx : & LateContext < ' tcx > , gen : & ' tcx Generics < ' _ > ) {
106- self . check_type_repetition ( cx, gen ) ;
107- check_trait_bound_duplication ( cx, gen ) ;
105+ fn check_generics ( & mut self , cx : & LateContext < ' tcx > , generics : & ' tcx Generics < ' _ > ) {
106+ self . check_type_repetition ( cx, generics ) ;
107+ check_trait_bound_duplication ( cx, generics ) ;
108108 }
109109
110110 fn check_item ( & mut self , cx : & LateContext < ' tcx > , item : & ' tcx Item < ' tcx > ) {
@@ -238,7 +238,7 @@ impl TraitBounds {
238238 }
239239
240240 #[ allow( clippy:: mutable_key_type) ]
241- fn check_type_repetition < ' tcx > ( & self , cx : & LateContext < ' tcx > , gen : & ' tcx Generics < ' _ > ) {
241+ fn check_type_repetition < ' tcx > ( & self , cx : & LateContext < ' tcx > , generics : & ' tcx Generics < ' _ > ) {
242242 struct SpanlessTy < ' cx , ' tcx > {
243243 ty : & ' tcx Ty < ' tcx > ,
244244 cx : & ' cx LateContext < ' tcx > ,
@@ -258,12 +258,12 @@ impl TraitBounds {
258258 }
259259 impl Eq for SpanlessTy < ' _ , ' _ > { }
260260
261- if gen . span . from_expansion ( ) {
261+ if generics . span . from_expansion ( ) {
262262 return ;
263263 }
264264 let mut map: UnhashMap < SpanlessTy < ' _ , ' _ > , Vec < & GenericBound < ' _ > > > = UnhashMap :: default ( ) ;
265265 let mut applicability = Applicability :: MaybeIncorrect ;
266- for bound in gen . predicates {
266+ for bound in generics . predicates {
267267 if let WherePredicate :: BoundPredicate ( ref p) = bound
268268 && p. origin != PredicateOrigin :: ImplTrait
269269 && p. bounds . len ( ) as u64 <= self . max_trait_bounds
@@ -301,8 +301,8 @@ impl TraitBounds {
301301 }
302302}
303303
304- fn check_trait_bound_duplication ( cx : & LateContext < ' _ > , gen : & ' _ Generics < ' _ > ) {
305- if gen . span . from_expansion ( ) {
304+ fn check_trait_bound_duplication ( cx : & LateContext < ' _ > , generics : & ' _ Generics < ' _ > ) {
305+ if generics . span . from_expansion ( ) {
306306 return ;
307307 }
308308
@@ -313,7 +313,7 @@ fn check_trait_bound_duplication(cx: &LateContext<'_>, gen: &'_ Generics<'_>) {
313313 // |
314314 // collects each of these where clauses into a set keyed by generic name and comparable trait
315315 // eg. (T, Clone)
316- let where_predicates = gen
316+ let where_predicates = generics
317317 . predicates
318318 . iter ( )
319319 . filter_map ( |pred| {
@@ -342,7 +342,7 @@ fn check_trait_bound_duplication(cx: &LateContext<'_>, gen: &'_ Generics<'_>) {
342342 // |
343343 // compare trait bounds keyed by generic name and comparable trait to collected where
344344 // predicates eg. (T, Clone)
345- for predicate in gen . predicates . iter ( ) . filter ( |pred| !pred. in_where_clause ( ) ) {
345+ for predicate in generics . predicates . iter ( ) . filter ( |pred| !pred. in_where_clause ( ) ) {
346346 if let WherePredicate :: BoundPredicate ( bound_predicate) = predicate
347347 && bound_predicate. origin != PredicateOrigin :: ImplTrait
348348 && !bound_predicate. span . from_expansion ( )
0 commit comments