Skip to content

Commit 185f4b0

Browse files
Fix trivial gen ident usage in tools
1 parent c1fd25d commit 185f4b0

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

clippy_lints/src/misc_early/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,8 @@ declare_lint_pass!(MiscEarlyLints => [
364364
]);
365365

366366
impl EarlyLintPass for MiscEarlyLints {
367-
fn check_generics(&mut self, cx: &EarlyContext<'_>, gen: &Generics) {
368-
for param in &gen.params {
367+
fn check_generics(&mut self, cx: &EarlyContext<'_>, generics: &Generics) {
368+
for param in &generics.params {
369369
builtin_type_shadow::check(cx, param);
370370
}
371371
}

clippy_lints/src/trait_bounds.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ impl TraitBounds {
102102
impl_lint_pass!(TraitBounds => [TYPE_REPETITION_IN_BOUNDS, TRAIT_DUPLICATION_IN_BOUNDS]);
103103

104104
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);
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()

clippy_lints/src/types/type_complexity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl<'tcx> Visitor<'tcx> for TypeComplexityVisitor {
5757
bound
5858
.bound_generic_params
5959
.iter()
60-
.any(|gen| matches!(gen.kind, GenericParamKind::Lifetime { .. }))
60+
.any(|param| matches!(param.kind, GenericParamKind::Lifetime { .. }))
6161
});
6262
if has_lifetime_parameters {
6363
// complex trait bounds like A<'a, 'b>

0 commit comments

Comments
 (0)