Simplify
This commit is contained in:
parent
0c9268c1ee
commit
6cf0cadfaa
@ -31,30 +31,8 @@ impl ChildBySource for TraitId {
|
|||||||
fn child_by_source_to(&self, db: &dyn DefDatabase, res: &mut DynMap, file_id: HirFileId) {
|
fn child_by_source_to(&self, db: &dyn DefDatabase, res: &mut DynMap, file_id: HirFileId) {
|
||||||
let data = db.trait_data(*self);
|
let data = db.trait_data(*self);
|
||||||
// FIXME attribute macros
|
// FIXME attribute macros
|
||||||
for (_name, item) in data.items.iter() {
|
for &(_, item) in data.items.iter() {
|
||||||
match *item {
|
child_by_source_assoc_items(db, res, file_id, item);
|
||||||
AssocItemId::FunctionId(func) => {
|
|
||||||
let loc = func.lookup(db);
|
|
||||||
if loc.id.file_id() == file_id {
|
|
||||||
let src = loc.source(db);
|
|
||||||
res[keys::FUNCTION].insert(src, func)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AssocItemId::ConstId(konst) => {
|
|
||||||
let loc = konst.lookup(db);
|
|
||||||
if loc.id.file_id() == file_id {
|
|
||||||
let src = loc.source(db);
|
|
||||||
res[keys::CONST].insert(src, konst)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
AssocItemId::TypeAliasId(ty) => {
|
|
||||||
let loc = ty.lookup(db);
|
|
||||||
if loc.id.file_id() == file_id {
|
|
||||||
let src = loc.source(db);
|
|
||||||
res[keys::TYPE_ALIAS].insert(src, ty)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,28 +42,37 @@ impl ChildBySource for ImplId {
|
|||||||
let data = db.impl_data(*self);
|
let data = db.impl_data(*self);
|
||||||
// FIXME attribute macros
|
// FIXME attribute macros
|
||||||
for &item in data.items.iter() {
|
for &item in data.items.iter() {
|
||||||
match item {
|
child_by_source_assoc_items(db, res, file_id, item);
|
||||||
AssocItemId::FunctionId(func) => {
|
}
|
||||||
let loc = func.lookup(db);
|
}
|
||||||
if loc.id.file_id() == file_id {
|
}
|
||||||
let src = loc.source(db);
|
|
||||||
res[keys::FUNCTION].insert(src, func)
|
fn child_by_source_assoc_items(
|
||||||
}
|
db: &dyn DefDatabase,
|
||||||
}
|
res: &mut DynMap,
|
||||||
AssocItemId::ConstId(konst) => {
|
file_id: HirFileId,
|
||||||
let loc = konst.lookup(db);
|
item: AssocItemId,
|
||||||
if loc.id.file_id() == file_id {
|
) {
|
||||||
let src = loc.source(db);
|
match item {
|
||||||
res[keys::CONST].insert(src, konst)
|
AssocItemId::FunctionId(func) => {
|
||||||
}
|
let loc = func.lookup(db);
|
||||||
}
|
if loc.id.file_id() == file_id {
|
||||||
AssocItemId::TypeAliasId(ty) => {
|
let src = loc.source(db);
|
||||||
let loc = ty.lookup(db);
|
res[keys::FUNCTION].insert(src, func)
|
||||||
if loc.id.file_id() == file_id {
|
}
|
||||||
let src = loc.source(db);
|
}
|
||||||
res[keys::TYPE_ALIAS].insert(src, ty)
|
AssocItemId::ConstId(konst) => {
|
||||||
}
|
let loc = konst.lookup(db);
|
||||||
}
|
if loc.id.file_id() == file_id {
|
||||||
|
let src = loc.source(db);
|
||||||
|
res[keys::CONST].insert(src, konst)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AssocItemId::TypeAliasId(ty) => {
|
||||||
|
let loc = ty.lookup(db);
|
||||||
|
if loc.id.file_id() == file_id {
|
||||||
|
let src = loc.source(db);
|
||||||
|
res[keys::TYPE_ALIAS].insert(src, ty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user