Add trait_item_def_id
to AssocItem
This allows avoiding some lookups by name
This commit is contained in:
parent
0b1ab91d66
commit
d7595853a2
11 changed files with 197 additions and 204 deletions
|
@ -710,13 +710,11 @@ impl<'tcx> SaveContext<'tcx> {
|
|||
}
|
||||
Res::Def(HirDefKind::AssocFn, decl_id) => {
|
||||
let def_id = if decl_id.is_local() {
|
||||
let ti = self.tcx.associated_item(decl_id);
|
||||
|
||||
self.tcx
|
||||
.associated_items(ti.container.id())
|
||||
.filter_by_name_unhygienic(ti.ident.name)
|
||||
.find(|item| item.defaultness.has_value())
|
||||
.map(|item| item.def_id)
|
||||
if self.tcx.associated_item(decl_id).defaultness.has_value() {
|
||||
Some(decl_id)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue