Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 80393ea

Browse files
committedJul 14, 2024
Fix trivial gen ident usage in tools
1 parent f08c43a commit 80393ea

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed
 

‎src/bootstrap/src/core/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1998,7 +1998,7 @@ impl<'a> Builder<'a> {
19981998
if mode == Mode::Rustc {
19991999
rustflags.arg("-Zunstable-options");
20002000
rustflags.arg("-Wrustc::internal");
2001-
// FIXME(edition_2024): Change this to `-Wrust_2018_idioms` when all
2001+
// FIXME(edition_2024): Change this to `-Wrust_2024_idioms` when all
20022002
// of the individual lints are satisfied.
20032003
rustflags.arg("-Wkeyword_idents_2024");
20042004
}

‎src/librustdoc/clean/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1052,12 +1052,12 @@ fn clean_fn_decl_legacy_const_generics(func: &mut Function, attrs: &[ast::Attrib
10521052
for (pos, literal) in meta_item_list.iter().filter_map(|meta| meta.lit()).enumerate() {
10531053
match literal.kind {
10541054
ast::LitKind::Int(a, _) => {
1055-
let gen = func.generics.params.remove(0);
1055+
let param = func.generics.params.remove(0);
10561056
if let GenericParamDef {
10571057
name,
10581058
kind: GenericParamDefKind::Const { ty, .. },
10591059
..
1060-
} = gen
1060+
} = param
10611061
{
10621062
func.decl
10631063
.inputs

‎src/librustdoc/html/render/search_index.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ fn simplify_fn_type<'tcx, 'a>(
10511051
let mut ty_generics = Vec::new();
10521052
let mut ty_constraints = Vec::new();
10531053
if let Some(arg_generics) = arg.generic_args() {
1054-
for ty in arg_generics.into_iter().filter_map(|gen| match gen {
1054+
for ty in arg_generics.into_iter().filter_map(|param| match param {
10551055
clean::GenericArg::Type(ty) => Some(ty),
10561056
_ => None,
10571057
}) {
@@ -1172,8 +1172,8 @@ fn simplify_fn_constraint<'tcx, 'a>(
11721172
) {
11731173
let mut ty_constraints = Vec::new();
11741174
let ty_constrained_assoc = RenderTypeId::AssociatedType(constraint.assoc.name);
1175-
for gen in &constraint.assoc.args {
1176-
match gen {
1175+
for param in &constraint.assoc.args {
1176+
match param {
11771177
clean::GenericArg::Type(arg) => simplify_fn_type(
11781178
self_,
11791179
generics,

‎src/tools/clippy/clippy_lints/src/misc_early/mod.rs

+2-2
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
}

‎src/tools/clippy/clippy_lints/src/trait_bounds.rs

+10-10
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()

‎src/tools/clippy/clippy_lints/src/types/type_complexity.rs

+1-1
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)
Failed to load comments.