Constify trait aliases

This commit is contained in:
Oli Scherer 2025-07-21 10:04:10 +00:00 committed by Oli Scherer
parent 07b6b325e2
commit 3f5ea6beb4
2 changed files with 9 additions and 2 deletions

View file

@ -528,7 +528,7 @@ impl LateLintPass<'_> for ItemNameRepetitions {
| ItemKind::Macro(ident, ..)
| ItemKind::Static(_, ident, ..)
| ItemKind::Trait(_, _, _, ident, ..)
| ItemKind::TraitAlias(ident, ..)
| ItemKind::TraitAlias(_, ident, ..)
| ItemKind::TyAlias(ident, ..)
| ItemKind::Union(ident, ..)
| ItemKind::Use(_, UseKind::Single(ident)) => ident,

View file

@ -478,13 +478,20 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
ident: li,
generics: lg,
bounds: lb,
constness: lc,
}),
TraitAlias(box ast::TraitAlias {
ident: ri,
generics: rg,
bounds: rb,
constness: rc,
}),
) => eq_id(*li, *ri) && eq_generics(lg, rg) && over(lb, rb, eq_generic_bound),
) => {
matches!(lc, ast::Const::No) == matches!(rc, ast::Const::No)
&& eq_id(*li, *ri)
&& eq_generics(lg, rg)
&& over(lb, rb, eq_generic_bound)
},
(
Impl(ast::Impl {
generics: lg,