Auto merge of #138740 - nnethercote:ast-ItemKind-idents, r=fmease
Move `ast::Item::ident` into `ast::ItemKind` The follow-up to #138384, which did the same thing for `hir::ItemKind`. r? `@fmease`
This commit is contained in:
commit
ed201574c5
59 changed files with 1217 additions and 1015 deletions
|
|
@ -53,7 +53,7 @@ declare_lint_pass!(CrateInMacroDef => [CRATE_IN_MACRO_DEF]);
|
|||
|
||||
impl EarlyLintPass for CrateInMacroDef {
|
||||
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
|
||||
if let ItemKind::MacroDef(macro_def) = &item.kind
|
||||
if let ItemKind::MacroDef(_, macro_def) = &item.kind
|
||||
&& item.attrs.iter().any(is_macro_export)
|
||||
&& let Some(span) = contains_unhygienic_crate_reference(¯o_def.body.tokens)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,16 +13,16 @@ use rustc_parse::parser::ForceCollect;
|
|||
use rustc_session::parse::ParseSess;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::source_map::{FilePathMapping, SourceMap};
|
||||
use rustc_span::{FileName, Pos, sym};
|
||||
use rustc_span::{FileName, Ident, Pos, sym};
|
||||
|
||||
use super::Fragments;
|
||||
|
||||
fn get_test_spans(item: &Item, test_attr_spans: &mut Vec<Range<usize>>) {
|
||||
fn get_test_spans(item: &Item, ident: Ident, test_attr_spans: &mut Vec<Range<usize>>) {
|
||||
test_attr_spans.extend(
|
||||
item.attrs
|
||||
.iter()
|
||||
.find(|attr| attr.has_name(sym::test))
|
||||
.map(|attr| attr.span.lo().to_usize()..item.ident.span.hi().to_usize()),
|
||||
.map(|attr| attr.span.lo().to_usize()..ident.span.hi().to_usize()),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -64,10 +64,10 @@ pub fn check(
|
|||
match parser.parse_item(ForceCollect::No) {
|
||||
Ok(Some(item)) => match &item.kind {
|
||||
ItemKind::Fn(box Fn {
|
||||
sig, body: Some(block), ..
|
||||
}) if item.ident.name == sym::main => {
|
||||
ident, sig, body: Some(block), ..
|
||||
}) if ident.name == sym::main => {
|
||||
if !ignore {
|
||||
get_test_spans(&item, &mut test_attr_spans);
|
||||
get_test_spans(&item, *ident, &mut test_attr_spans);
|
||||
}
|
||||
let is_async = matches!(sig.header.coroutine_kind, Some(CoroutineKind::Async { .. }));
|
||||
let returns_nothing = match &sig.decl.output {
|
||||
|
|
@ -85,10 +85,10 @@ pub fn check(
|
|||
}
|
||||
},
|
||||
// Another function was found; this case is ignored for needless_doctest_main
|
||||
ItemKind::Fn(box Fn { .. }) => {
|
||||
ItemKind::Fn(fn_) => {
|
||||
eligible = false;
|
||||
if !ignore {
|
||||
get_test_spans(&item, &mut test_attr_spans);
|
||||
get_test_spans(&item, fn_.ident, &mut test_attr_spans);
|
||||
}
|
||||
},
|
||||
// Tests with one of these items are ignored
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ impl_lint_pass!(DuplicateMod => [DUPLICATE_MOD]);
|
|||
|
||||
impl EarlyLintPass for DuplicateMod {
|
||||
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
|
||||
if let ItemKind::Mod(_, ModKind::Loaded(_, Inline::No, mod_spans, _)) = &item.kind
|
||||
if let ItemKind::Mod(_, _, ModKind::Loaded(_, Inline::No, mod_spans, _)) = &item.kind
|
||||
&& let FileName::Real(real) = cx.sess().source_map().span_to_filename(mod_spans.inner_span)
|
||||
&& let Some(local_path) = real.into_local_path()
|
||||
&& let Ok(absolute_path) = local_path.canonicalize()
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@ use rustc_errors::{Applicability, Diag, SuggestionStyle};
|
|||
use rustc_lexer::TokenKind;
|
||||
use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
|
||||
use rustc_session::impl_lint_pass;
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::{BytePos, ExpnKind, Ident, InnerSpan, Span, SpanData, Symbol};
|
||||
use rustc_span::{BytePos, ExpnKind, Ident, InnerSpan, Span, SpanData, Symbol, kw};
|
||||
|
||||
declare_clippy_lint! {
|
||||
/// ### What it does
|
||||
|
|
@ -375,21 +374,23 @@ impl EmptyLineAfter {
|
|||
&mut self,
|
||||
cx: &EarlyContext<'_>,
|
||||
kind: &ItemKind,
|
||||
ident: &Ident,
|
||||
ident: Option<Ident>,
|
||||
span: Span,
|
||||
attrs: &[Attribute],
|
||||
id: NodeId,
|
||||
) {
|
||||
self.items.push(ItemInfo {
|
||||
kind: kind.descr(),
|
||||
name: ident.name,
|
||||
span: if span.contains(ident.span) {
|
||||
// FIXME: this `sym::empty` can be leaked, see
|
||||
// https://github.com/rust-lang/rust/pull/138740#discussion_r2021979899
|
||||
name: if let Some(ident) = ident { ident.name } else { kw::Empty },
|
||||
span: if let Some(ident) = ident {
|
||||
span.with_hi(ident.span.hi())
|
||||
} else {
|
||||
span.with_hi(span.lo())
|
||||
},
|
||||
mod_items: match kind {
|
||||
ItemKind::Mod(_, ModKind::Loaded(items, _, _, _)) => items
|
||||
ItemKind::Mod(_, _, ModKind::Loaded(items, _, _, _)) => items
|
||||
.iter()
|
||||
.filter(|i| !matches!(i.span.ctxt().outer_expn_data().kind, ExpnKind::AstPass(_)))
|
||||
.map(|i| i.id)
|
||||
|
|
@ -471,7 +472,7 @@ impl EarlyLintPass for EmptyLineAfter {
|
|||
self.check_item_kind(
|
||||
cx,
|
||||
&item.kind.clone().into(),
|
||||
&item.ident,
|
||||
item.kind.ident(),
|
||||
item.span,
|
||||
&item.attrs,
|
||||
item.id,
|
||||
|
|
@ -482,7 +483,7 @@ impl EarlyLintPass for EmptyLineAfter {
|
|||
self.check_item_kind(
|
||||
cx,
|
||||
&item.kind.clone().into(),
|
||||
&item.ident,
|
||||
item.kind.ident(),
|
||||
item.span,
|
||||
&item.attrs,
|
||||
item.id,
|
||||
|
|
@ -490,6 +491,6 @@ impl EarlyLintPass for EmptyLineAfter {
|
|||
}
|
||||
|
||||
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
|
||||
self.check_item_kind(cx, &item.kind, &item.ident, item.span, &item.attrs, item.id);
|
||||
self.check_item_kind(cx, &item.kind, item.kind.ident(), item.span, &item.attrs, item.id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,10 +74,9 @@ declare_lint_pass!(EmptyWithBrackets => [EMPTY_STRUCTS_WITH_BRACKETS, EMPTY_ENUM
|
|||
|
||||
impl EarlyLintPass for EmptyWithBrackets {
|
||||
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
|
||||
let span_after_ident = item.span.with_lo(item.ident.span.hi());
|
||||
|
||||
if let ItemKind::Struct(var_data, _) = &item.kind
|
||||
if let ItemKind::Struct(ident, var_data, _) = &item.kind
|
||||
&& has_brackets(var_data)
|
||||
&& let span_after_ident = item.span.with_lo(ident.span.hi())
|
||||
&& has_no_fields(cx, var_data, span_after_ident)
|
||||
{
|
||||
span_lint_and_then(
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ declare_lint_pass!(FieldScopedVisibilityModifiers => [FIELD_SCOPED_VISIBILITY_MO
|
|||
|
||||
impl EarlyLintPass for FieldScopedVisibilityModifiers {
|
||||
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
|
||||
let ItemKind::Struct(ref st, _) = item.kind else {
|
||||
let ItemKind::Struct(_, ref st, _) = item.kind else {
|
||||
return;
|
||||
};
|
||||
for field in st.fields() {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ declare_lint_pass!(MultipleBoundLocations => [MULTIPLE_BOUND_LOCATIONS]);
|
|||
|
||||
impl EarlyLintPass for MultipleBoundLocations {
|
||||
fn check_fn(&mut self, cx: &EarlyContext<'_>, kind: FnKind<'_>, _: Span, _: NodeId) {
|
||||
if let FnKind::Fn(_, _, _, Fn { generics, .. }) = kind
|
||||
if let FnKind::Fn(_, _, Fn { generics, .. }) = kind
|
||||
&& !generics.params.is_empty()
|
||||
&& !generics.where_clause.predicates.is_empty()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ declare_lint_pass!(PartialPubFields => [PARTIAL_PUB_FIELDS]);
|
|||
|
||||
impl EarlyLintPass for PartialPubFields {
|
||||
fn check_item(&mut self, cx: &EarlyContext<'_>, item: &Item) {
|
||||
let ItemKind::Struct(ref st, _) = item.kind else {
|
||||
let ItemKind::Struct(_, ref st, _) = item.kind else {
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -174,11 +174,11 @@ impl SingleComponentPathImports {
|
|||
}
|
||||
|
||||
match &item.kind {
|
||||
ItemKind::Mod(_, ModKind::Loaded(items, ..)) => {
|
||||
ItemKind::Mod(_, _, ModKind::Loaded(items, ..)) => {
|
||||
self.check_mod(items);
|
||||
},
|
||||
ItemKind::MacroDef(MacroDef { macro_rules: true, .. }) => {
|
||||
macros.push(item.ident.name);
|
||||
ItemKind::MacroDef(ident, MacroDef { macro_rules: true, .. }) => {
|
||||
macros.push(ident.name);
|
||||
},
|
||||
ItemKind::Use(use_tree) => {
|
||||
let segments = &use_tree.prefix.segments;
|
||||
|
|
|
|||
|
|
@ -321,17 +321,18 @@ pub fn eq_local_kind(l: &LocalKind, r: &LocalKind) -> bool {
|
|||
}
|
||||
|
||||
pub fn eq_item<K>(l: &Item<K>, r: &Item<K>, mut eq_kind: impl FnMut(&K, &K) -> bool) -> bool {
|
||||
eq_id(l.ident, r.ident) && over(&l.attrs, &r.attrs, eq_attr) && eq_vis(&l.vis, &r.vis) && eq_kind(&l.kind, &r.kind)
|
||||
over(&l.attrs, &r.attrs, eq_attr) && eq_vis(&l.vis, &r.vis) && eq_kind(&l.kind, &r.kind)
|
||||
}
|
||||
|
||||
#[expect(clippy::similar_names, clippy::too_many_lines)] // Just a big match statement
|
||||
pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
||||
use ItemKind::*;
|
||||
match (l, r) {
|
||||
(ExternCrate(l), ExternCrate(r)) => l == r,
|
||||
(ExternCrate(ls, li), ExternCrate(rs, ri)) => ls == rs && eq_id(*li, *ri),
|
||||
(Use(l), Use(r)) => eq_use_tree(l, r),
|
||||
(
|
||||
Static(box StaticItem {
|
||||
ident: li,
|
||||
ty: lt,
|
||||
mutability: lm,
|
||||
expr: le,
|
||||
|
|
@ -339,16 +340,22 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
|||
define_opaque: _,
|
||||
}),
|
||||
Static(box StaticItem {
|
||||
ident: ri,
|
||||
ty: rt,
|
||||
mutability: rm,
|
||||
expr: re,
|
||||
safety: rs,
|
||||
define_opaque: _,
|
||||
}),
|
||||
) => lm == rm && ls == rs && eq_ty(lt, rt) && eq_expr_opt(le.as_ref(), re.as_ref()),
|
||||
) => eq_id(*li, *ri)
|
||||
&& lm == rm
|
||||
&& ls == rs
|
||||
&& eq_ty(lt, rt)
|
||||
&& eq_expr_opt(le.as_ref(), re.as_ref()),
|
||||
(
|
||||
Const(box ConstItem {
|
||||
defaultness: ld,
|
||||
ident: li,
|
||||
generics: lg,
|
||||
ty: lt,
|
||||
expr: le,
|
||||
|
|
@ -356,16 +363,22 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
|||
}),
|
||||
Const(box ConstItem {
|
||||
defaultness: rd,
|
||||
ident: ri,
|
||||
generics: rg,
|
||||
ty: rt,
|
||||
expr: re,
|
||||
define_opaque: _,
|
||||
}),
|
||||
) => eq_defaultness(*ld, *rd) && eq_generics(lg, rg) && eq_ty(lt, rt) && eq_expr_opt(le.as_ref(), re.as_ref()),
|
||||
) => eq_defaultness(*ld, *rd)
|
||||
&& eq_id(*li, *ri)
|
||||
&& eq_generics(lg, rg)
|
||||
&& eq_ty(lt, rt)
|
||||
&& eq_expr_opt(le.as_ref(), re.as_ref()),
|
||||
(
|
||||
Fn(box ast::Fn {
|
||||
defaultness: ld,
|
||||
sig: lf,
|
||||
ident: li,
|
||||
generics: lg,
|
||||
contract: lc,
|
||||
body: lb,
|
||||
|
|
@ -374,6 +387,7 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
|||
Fn(box ast::Fn {
|
||||
defaultness: rd,
|
||||
sig: rf,
|
||||
ident: ri,
|
||||
generics: rg,
|
||||
contract: rc,
|
||||
body: rb,
|
||||
|
|
@ -382,12 +396,14 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
|||
) => {
|
||||
eq_defaultness(*ld, *rd)
|
||||
&& eq_fn_sig(lf, rf)
|
||||
&& eq_id(*li, *ri)
|
||||
&& eq_generics(lg, rg)
|
||||
&& eq_opt_fn_contract(lc, rc)
|
||||
&& both(lb.as_ref(), rb.as_ref(), |l, r| eq_block(l, r))
|
||||
},
|
||||
(Mod(lu, lmk), Mod(ru, rmk)) => {
|
||||
lu == ru
|
||||
(Mod(ls, li, lmk), Mod(rs, ri, rmk)) => {
|
||||
ls == rs
|
||||
&& eq_id(*li, *ri)
|
||||
&& match (lmk, rmk) {
|
||||
(ModKind::Loaded(litems, linline, _, _), ModKind::Loaded(ritems, rinline, _, _)) => {
|
||||
linline == rinline && over(litems, ritems, |l, r| eq_item(l, r, eq_item_kind))
|
||||
|
|
@ -421,33 +437,40 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
|||
&& over(lb, rb, eq_generic_bound)
|
||||
&& both(lt.as_ref(), rt.as_ref(), |l, r| eq_ty(l, r))
|
||||
},
|
||||
(Enum(le, lg), Enum(re, rg)) => over(&le.variants, &re.variants, eq_variant) && eq_generics(lg, rg),
|
||||
(Struct(lv, lg), Struct(rv, rg)) | (Union(lv, lg), Union(rv, rg)) => {
|
||||
eq_variant_data(lv, rv) && eq_generics(lg, rg)
|
||||
(Enum(li, le, lg), Enum(ri, re, rg)) => {
|
||||
eq_id(*li, *ri) && over(&le.variants, &re.variants, eq_variant) && eq_generics(lg, rg)
|
||||
}
|
||||
(Struct(li, lv, lg), Struct(ri, rv, rg)) | (Union(li, lv, lg), Union(ri, rv, rg)) => {
|
||||
eq_id(*li, *ri) && eq_variant_data(lv, rv) && eq_generics(lg, rg)
|
||||
},
|
||||
(
|
||||
Trait(box ast::Trait {
|
||||
is_auto: la,
|
||||
safety: lu,
|
||||
ident: li,
|
||||
generics: lg,
|
||||
bounds: lb,
|
||||
items: li,
|
||||
items: lis,
|
||||
}),
|
||||
Trait(box ast::Trait {
|
||||
is_auto: ra,
|
||||
safety: ru,
|
||||
ident: ri,
|
||||
generics: rg,
|
||||
bounds: rb,
|
||||
items: ri,
|
||||
items: ris,
|
||||
}),
|
||||
) => {
|
||||
la == ra
|
||||
&& matches!(lu, Safety::Default) == matches!(ru, Safety::Default)
|
||||
&& eq_id(*li, *ri)
|
||||
&& eq_generics(lg, rg)
|
||||
&& over(lb, rb, eq_generic_bound)
|
||||
&& over(li, ri, |l, r| eq_item(l, r, eq_assoc_item_kind))
|
||||
&& over(lis, ris, |l, r| eq_item(l, r, eq_assoc_item_kind))
|
||||
},
|
||||
(TraitAlias(lg, lb), TraitAlias(rg, rb)) => eq_generics(lg, rg) && over(lb, rb, eq_generic_bound),
|
||||
(TraitAlias(li, lg, lb), TraitAlias(ri, rg, rb)) => {
|
||||
eq_id(*li, *ri) && eq_generics(lg, rg) && over(lb, rb, eq_generic_bound)
|
||||
}
|
||||
(
|
||||
Impl(box ast::Impl {
|
||||
safety: lu,
|
||||
|
|
@ -480,7 +503,9 @@ pub fn eq_item_kind(l: &ItemKind, r: &ItemKind) -> bool {
|
|||
&& over(li, ri, |l, r| eq_item(l, r, eq_assoc_item_kind))
|
||||
},
|
||||
(MacCall(l), MacCall(r)) => eq_mac_call(l, r),
|
||||
(MacroDef(l), MacroDef(r)) => l.macro_rules == r.macro_rules && eq_delim_args(&l.body, &r.body),
|
||||
(MacroDef(li, ld), MacroDef(ri, rd)) => {
|
||||
eq_id(*li, *ri) && ld.macro_rules == rd.macro_rules && eq_delim_args(&ld.body, &rd.body)
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
|
@ -490,6 +515,7 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
|
|||
match (l, r) {
|
||||
(
|
||||
Static(box StaticItem {
|
||||
ident: li,
|
||||
ty: lt,
|
||||
mutability: lm,
|
||||
expr: le,
|
||||
|
|
@ -497,17 +523,25 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
|
|||
define_opaque: _,
|
||||
}),
|
||||
Static(box StaticItem {
|
||||
ident: ri,
|
||||
ty: rt,
|
||||
mutability: rm,
|
||||
expr: re,
|
||||
safety: rs,
|
||||
define_opaque: _,
|
||||
}),
|
||||
) => lm == rm && eq_ty(lt, rt) && eq_expr_opt(le.as_ref(), re.as_ref()) && ls == rs,
|
||||
) => {
|
||||
eq_id(*li, *ri)
|
||||
&& eq_ty(lt, rt)
|
||||
&& lm == rm
|
||||
&& eq_expr_opt(le.as_ref(), re.as_ref())
|
||||
&& ls == rs
|
||||
}
|
||||
(
|
||||
Fn(box ast::Fn {
|
||||
defaultness: ld,
|
||||
sig: lf,
|
||||
ident: li,
|
||||
generics: lg,
|
||||
contract: lc,
|
||||
body: lb,
|
||||
|
|
@ -516,6 +550,7 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
|
|||
Fn(box ast::Fn {
|
||||
defaultness: rd,
|
||||
sig: rf,
|
||||
ident: ri,
|
||||
generics: rg,
|
||||
contract: rc,
|
||||
body: rb,
|
||||
|
|
@ -524,6 +559,7 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
|
|||
) => {
|
||||
eq_defaultness(*ld, *rd)
|
||||
&& eq_fn_sig(lf, rf)
|
||||
&& eq_id(*li, *ri)
|
||||
&& eq_generics(lg, rg)
|
||||
&& eq_opt_fn_contract(lc, rc)
|
||||
&& both(lb.as_ref(), rb.as_ref(), |l, r| eq_block(l, r))
|
||||
|
|
@ -531,20 +567,23 @@ pub fn eq_foreign_item_kind(l: &ForeignItemKind, r: &ForeignItemKind) -> bool {
|
|||
(
|
||||
TyAlias(box ast::TyAlias {
|
||||
defaultness: ld,
|
||||
ident: li,
|
||||
generics: lg,
|
||||
where_clauses: _,
|
||||
bounds: lb,
|
||||
ty: lt,
|
||||
..
|
||||
}),
|
||||
TyAlias(box ast::TyAlias {
|
||||
defaultness: rd,
|
||||
ident: ri,
|
||||
generics: rg,
|
||||
where_clauses: _,
|
||||
bounds: rb,
|
||||
ty: rt,
|
||||
..
|
||||
}),
|
||||
) => {
|
||||
eq_defaultness(*ld, *rd)
|
||||
&& eq_id(*li, *ri)
|
||||
&& eq_generics(lg, rg)
|
||||
&& over(lb, rb, eq_generic_bound)
|
||||
&& both(lt.as_ref(), rt.as_ref(), |l, r| eq_ty(l, r))
|
||||
|
|
@ -560,6 +599,7 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
|
|||
(
|
||||
Const(box ConstItem {
|
||||
defaultness: ld,
|
||||
ident: li,
|
||||
generics: lg,
|
||||
ty: lt,
|
||||
expr: le,
|
||||
|
|
@ -567,16 +607,24 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
|
|||
}),
|
||||
Const(box ConstItem {
|
||||
defaultness: rd,
|
||||
ident: ri,
|
||||
generics: rg,
|
||||
ty: rt,
|
||||
expr: re,
|
||||
define_opaque: _,
|
||||
}),
|
||||
) => eq_defaultness(*ld, *rd) && eq_generics(lg, rg) && eq_ty(lt, rt) && eq_expr_opt(le.as_ref(), re.as_ref()),
|
||||
) => {
|
||||
eq_defaultness(*ld, *rd)
|
||||
&& eq_id(*li, *ri)
|
||||
&& eq_generics(lg, rg)
|
||||
&& eq_ty(lt, rt)
|
||||
&& eq_expr_opt(le.as_ref(), re.as_ref())
|
||||
}
|
||||
(
|
||||
Fn(box ast::Fn {
|
||||
defaultness: ld,
|
||||
sig: lf,
|
||||
ident: li,
|
||||
generics: lg,
|
||||
contract: lc,
|
||||
body: lb,
|
||||
|
|
@ -585,6 +633,7 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
|
|||
Fn(box ast::Fn {
|
||||
defaultness: rd,
|
||||
sig: rf,
|
||||
ident: ri,
|
||||
generics: rg,
|
||||
contract: rc,
|
||||
body: rb,
|
||||
|
|
@ -593,6 +642,7 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
|
|||
) => {
|
||||
eq_defaultness(*ld, *rd)
|
||||
&& eq_fn_sig(lf, rf)
|
||||
&& eq_id(*li, *ri)
|
||||
&& eq_generics(lg, rg)
|
||||
&& eq_opt_fn_contract(lc, rc)
|
||||
&& both(lb.as_ref(), rb.as_ref(), |l, r| eq_block(l, r))
|
||||
|
|
@ -600,20 +650,23 @@ pub fn eq_assoc_item_kind(l: &AssocItemKind, r: &AssocItemKind) -> bool {
|
|||
(
|
||||
Type(box TyAlias {
|
||||
defaultness: ld,
|
||||
ident: li,
|
||||
generics: lg,
|
||||
where_clauses: _,
|
||||
bounds: lb,
|
||||
ty: lt,
|
||||
..
|
||||
}),
|
||||
Type(box TyAlias {
|
||||
defaultness: rd,
|
||||
ident: ri,
|
||||
generics: rg,
|
||||
where_clauses: _,
|
||||
bounds: rb,
|
||||
ty: rt,
|
||||
..
|
||||
}),
|
||||
) => {
|
||||
eq_defaultness(*ld, *rd)
|
||||
&& eq_id(*li, *ri)
|
||||
&& eq_generics(lg, rg)
|
||||
&& over(lb, rb, eq_generic_bound)
|
||||
&& both(lt.as_ref(), rt.as_ref(), |l, r| eq_ty(l, r))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue