@@ -104,9 +104,9 @@ impl TraitBounds {
104
104
impl_lint_pass ! ( TraitBounds => [ TYPE_REPETITION_IN_BOUNDS , TRAIT_DUPLICATION_IN_BOUNDS ] ) ;
105
105
106
106
impl < ' tcx > LateLintPass < ' tcx > for TraitBounds {
107
- fn check_generics ( & mut self , cx : & LateContext < ' tcx > , gen : & ' tcx Generics < ' _ > ) {
108
- self . check_type_repetition ( cx, gen ) ;
109
- check_trait_bound_duplication ( cx, gen ) ;
107
+ fn check_generics ( & mut self , cx : & LateContext < ' tcx > , generics : & ' tcx Generics < ' _ > ) {
108
+ self . check_type_repetition ( cx, generics ) ;
109
+ check_trait_bound_duplication ( cx, generics ) ;
110
110
}
111
111
112
112
fn check_item ( & mut self , cx : & LateContext < ' tcx > , item : & ' tcx Item < ' tcx > ) {
@@ -240,7 +240,7 @@ impl TraitBounds {
240
240
}
241
241
242
242
#[ allow( clippy:: mutable_key_type) ]
243
- fn check_type_repetition < ' tcx > ( & self , cx : & LateContext < ' tcx > , gen : & ' tcx Generics < ' _ > ) {
243
+ fn check_type_repetition < ' tcx > ( & self , cx : & LateContext < ' tcx > , generics : & ' tcx Generics < ' _ > ) {
244
244
struct SpanlessTy < ' cx , ' tcx > {
245
245
ty : & ' tcx Ty < ' tcx > ,
246
246
cx : & ' cx LateContext < ' tcx > ,
@@ -260,12 +260,12 @@ impl TraitBounds {
260
260
}
261
261
impl Eq for SpanlessTy < ' _ , ' _ > { }
262
262
263
- if gen . span . from_expansion ( ) {
263
+ if generics . span . from_expansion ( ) {
264
264
return ;
265
265
}
266
266
let mut map: UnhashMap < SpanlessTy < ' _ , ' _ > , Vec < & GenericBound < ' _ > > > = UnhashMap :: default ( ) ;
267
267
let mut applicability = Applicability :: MaybeIncorrect ;
268
- for bound in gen . predicates {
268
+ for bound in generics . predicates {
269
269
if let WherePredicate :: BoundPredicate ( ref p) = bound
270
270
&& p. origin != PredicateOrigin :: ImplTrait
271
271
&& p. bounds . len ( ) as u64 <= self . max_trait_bounds
@@ -303,8 +303,8 @@ impl TraitBounds {
303
303
}
304
304
}
305
305
306
- fn check_trait_bound_duplication ( cx : & LateContext < ' _ > , gen : & ' _ Generics < ' _ > ) {
307
- if gen . span . from_expansion ( ) {
306
+ fn check_trait_bound_duplication ( cx : & LateContext < ' _ > , generics : & ' _ Generics < ' _ > ) {
307
+ if generics . span . from_expansion ( ) {
308
308
return ;
309
309
}
310
310
@@ -315,7 +315,7 @@ fn check_trait_bound_duplication(cx: &LateContext<'_>, gen: &'_ Generics<'_>) {
315
315
// |
316
316
// collects each of these where clauses into a set keyed by generic name and comparable trait
317
317
// eg. (T, Clone)
318
- let where_predicates = gen
318
+ let where_predicates = generics
319
319
. predicates
320
320
. iter ( )
321
321
. filter_map ( |pred| {
@@ -344,7 +344,7 @@ fn check_trait_bound_duplication(cx: &LateContext<'_>, gen: &'_ Generics<'_>) {
344
344
// |
345
345
// compare trait bounds keyed by generic name and comparable trait to collected where
346
346
// predicates eg. (T, Clone)
347
- for predicate in gen . predicates . iter ( ) . filter ( |pred| !pred. in_where_clause ( ) ) {
347
+ for predicate in generics . predicates . iter ( ) . filter ( |pred| !pred. in_where_clause ( ) ) {
348
348
if let WherePredicate :: BoundPredicate ( bound_predicate) = predicate
349
349
&& bound_predicate. origin != PredicateOrigin :: ImplTrait
350
350
&& !bound_predicate. span . from_expansion ( )
0 commit comments