Skip to content

Commit

Permalink
Fix trivial gen ident usage in tools
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Jul 14, 2024
1 parent f08c43a commit 80393ea
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@ impl<'a> Builder<'a> {
if mode == Mode::Rustc {
rustflags.arg("-Zunstable-options");
rustflags.arg("-Wrustc::internal");
// FIXME(edition_2024): Change this to `-Wrust_2018_idioms` when all
// FIXME(edition_2024): Change this to `-Wrust_2024_idioms` when all
// of the individual lints are satisfied.
rustflags.arg("-Wkeyword_idents_2024");
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1052,12 +1052,12 @@ fn clean_fn_decl_legacy_const_generics(func: &mut Function, attrs: &[ast::Attrib
for (pos, literal) in meta_item_list.iter().filter_map(|meta| meta.lit()).enumerate() {
match literal.kind {
ast::LitKind::Int(a, _) => {
let gen = func.generics.params.remove(0);
let param = func.generics.params.remove(0);
if let GenericParamDef {
name,
kind: GenericParamDefKind::Const { ty, .. },
..
} = gen
} = param
{
func.decl
.inputs
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/html/render/search_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ fn simplify_fn_type<'tcx, 'a>(
let mut ty_generics = Vec::new();
let mut ty_constraints = Vec::new();
if let Some(arg_generics) = arg.generic_args() {
for ty in arg_generics.into_iter().filter_map(|gen| match gen {
for ty in arg_generics.into_iter().filter_map(|param| match param {
clean::GenericArg::Type(ty) => Some(ty),
_ => None,
}) {
Expand Down Expand Up @@ -1172,8 +1172,8 @@ fn simplify_fn_constraint<'tcx, 'a>(
) {
let mut ty_constraints = Vec::new();
let ty_constrained_assoc = RenderTypeId::AssociatedType(constraint.assoc.name);
for gen in &constraint.assoc.args {
match gen {
for param in &constraint.assoc.args {
match param {
clean::GenericArg::Type(arg) => simplify_fn_type(
self_,
generics,
Expand Down
4 changes: 2 additions & 2 deletions src/tools/clippy/clippy_lints/src/misc_early/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,8 @@ declare_lint_pass!(MiscEarlyLints => [
]);

impl EarlyLintPass for MiscEarlyLints {
fn check_generics(&mut self, cx: &EarlyContext<'_>, gen: &Generics) {
for param in &gen.params {
fn check_generics(&mut self, cx: &EarlyContext<'_>, generics: &Generics) {
for param in &generics.params {
builtin_type_shadow::check(cx, param);
}
}
Expand Down
20 changes: 10 additions & 10 deletions src/tools/clippy/clippy_lints/src/trait_bounds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ impl TraitBounds {
impl_lint_pass!(TraitBounds => [TYPE_REPETITION_IN_BOUNDS, TRAIT_DUPLICATION_IN_BOUNDS]);

impl<'tcx> LateLintPass<'tcx> for TraitBounds {
fn check_generics(&mut self, cx: &LateContext<'tcx>, gen: &'tcx Generics<'_>) {
self.check_type_repetition(cx, gen);
check_trait_bound_duplication(cx, gen);
fn check_generics(&mut self, cx: &LateContext<'tcx>, generics: &'tcx Generics<'_>) {
self.check_type_repetition(cx, generics);
check_trait_bound_duplication(cx, generics);
}

fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'tcx>) {
Expand Down Expand Up @@ -238,7 +238,7 @@ impl TraitBounds {
}

#[allow(clippy::mutable_key_type)]
fn check_type_repetition<'tcx>(&self, cx: &LateContext<'tcx>, gen: &'tcx Generics<'_>) {
fn check_type_repetition<'tcx>(&self, cx: &LateContext<'tcx>, generics: &'tcx Generics<'_>) {
struct SpanlessTy<'cx, 'tcx> {
ty: &'tcx Ty<'tcx>,
cx: &'cx LateContext<'tcx>,
Expand All @@ -258,12 +258,12 @@ impl TraitBounds {
}
impl Eq for SpanlessTy<'_, '_> {}

if gen.span.from_expansion() {
if generics.span.from_expansion() {
return;
}
let mut map: UnhashMap<SpanlessTy<'_, '_>, Vec<&GenericBound<'_>>> = UnhashMap::default();
let mut applicability = Applicability::MaybeIncorrect;
for bound in gen.predicates {
for bound in generics.predicates {
if let WherePredicate::BoundPredicate(ref p) = bound
&& p.origin != PredicateOrigin::ImplTrait
&& p.bounds.len() as u64 <= self.max_trait_bounds
Expand Down Expand Up @@ -301,8 +301,8 @@ impl TraitBounds {
}
}

fn check_trait_bound_duplication(cx: &LateContext<'_>, gen: &'_ Generics<'_>) {
if gen.span.from_expansion() {
fn check_trait_bound_duplication(cx: &LateContext<'_>, generics: &'_ Generics<'_>) {
if generics.span.from_expansion() {
return;
}

Expand All @@ -313,7 +313,7 @@ fn check_trait_bound_duplication(cx: &LateContext<'_>, gen: &'_ Generics<'_>) {
// |
// collects each of these where clauses into a set keyed by generic name and comparable trait
// eg. (T, Clone)
let where_predicates = gen
let where_predicates = generics
.predicates
.iter()
.filter_map(|pred| {
Expand Down Expand Up @@ -342,7 +342,7 @@ fn check_trait_bound_duplication(cx: &LateContext<'_>, gen: &'_ Generics<'_>) {
// |
// compare trait bounds keyed by generic name and comparable trait to collected where
// predicates eg. (T, Clone)
for predicate in gen.predicates.iter().filter(|pred| !pred.in_where_clause()) {
for predicate in generics.predicates.iter().filter(|pred| !pred.in_where_clause()) {
if let WherePredicate::BoundPredicate(bound_predicate) = predicate
&& bound_predicate.origin != PredicateOrigin::ImplTrait
&& !bound_predicate.span.from_expansion()
Expand Down
2 changes: 1 addition & 1 deletion src/tools/clippy/clippy_lints/src/types/type_complexity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl<'tcx> Visitor<'tcx> for TypeComplexityVisitor {
bound
.bound_generic_params
.iter()
.any(|gen| matches!(gen.kind, GenericParamKind::Lifetime { .. }))
.any(|param| matches!(param.kind, GenericParamKind::Lifetime { .. }))
});
if has_lifetime_parameters {
// complex trait bounds like A<'a, 'b>
Expand Down

0 comments on commit 80393ea

Please sign in to comment.