@@ -102,9 +102,9 @@ impl TraitBounds {
102
102
impl_lint_pass ! ( TraitBounds => [ TYPE_REPETITION_IN_BOUNDS , TRAIT_DUPLICATION_IN_BOUNDS ] ) ;
103
103
104
104
impl < ' 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 ) ;
108
108
}
109
109
110
110
fn check_item ( & mut self , cx : & LateContext < ' tcx > , item : & ' tcx Item < ' tcx > ) {
@@ -238,7 +238,7 @@ impl TraitBounds {
238
238
}
239
239
240
240
#[ 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 < ' _ > ) {
242
242
struct SpanlessTy < ' cx , ' tcx > {
243
243
ty : & ' tcx Ty < ' tcx > ,
244
244
cx : & ' cx LateContext < ' tcx > ,
@@ -258,12 +258,12 @@ impl TraitBounds {
258
258
}
259
259
impl Eq for SpanlessTy < ' _ , ' _ > { }
260
260
261
- if gen . span . from_expansion ( ) {
261
+ if generics . span . from_expansion ( ) {
262
262
return ;
263
263
}
264
264
let mut map: UnhashMap < SpanlessTy < ' _ , ' _ > , Vec < & GenericBound < ' _ > > > = UnhashMap :: default ( ) ;
265
265
let mut applicability = Applicability :: MaybeIncorrect ;
266
- for bound in gen . predicates {
266
+ for bound in generics . predicates {
267
267
if let WherePredicate :: BoundPredicate ( ref p) = bound
268
268
&& p. origin != PredicateOrigin :: ImplTrait
269
269
&& p. bounds . len ( ) as u64 <= self . max_trait_bounds
@@ -301,8 +301,8 @@ impl TraitBounds {
301
301
}
302
302
}
303
303
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 ( ) {
306
306
return ;
307
307
}
308
308
@@ -313,7 +313,7 @@ fn check_trait_bound_duplication(cx: &LateContext<'_>, gen: &'_ Generics<'_>) {
313
313
// |
314
314
// collects each of these where clauses into a set keyed by generic name and comparable trait
315
315
// eg. (T, Clone)
316
- let where_predicates = gen
316
+ let where_predicates = generics
317
317
. predicates
318
318
. iter ( )
319
319
. filter_map ( |pred| {
@@ -342,7 +342,7 @@ fn check_trait_bound_duplication(cx: &LateContext<'_>, gen: &'_ Generics<'_>) {
342
342
// |
343
343
// compare trait bounds keyed by generic name and comparable trait to collected where
344
344
// 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 ( ) ) {
346
346
if let WherePredicate :: BoundPredicate ( bound_predicate) = predicate
347
347
&& bound_predicate. origin != PredicateOrigin :: ImplTrait
348
348
&& !bound_predicate. span . from_expansion ( )
0 commit comments