Replace doc_comments_and_attrs with collect_attrs, 2nd round

This commit is contained in:
hkalbasi 2023-12-11 22:56:50 +03:30
parent 3aa6306728
commit 801c0ea478
7 changed files with 57 additions and 55 deletions

View file

@ -5,8 +5,7 @@
//! node for a *child*, and get its hir.
use either::Either;
use hir_expand::HirFileId;
use syntax::ast::HasDocComments;
use hir_expand::{attrs::collect_attrs, HirFileId};
use crate::{
db::DefDatabase,
@ -118,8 +117,8 @@ impl ChildBySource for ItemScope {
|(ast_id, calls)| {
let adt = ast_id.to_node(db.upcast());
calls.for_each(|(attr_id, call_id, calls)| {
if let Some(Either::Left(attr)) =
adt.doc_comments_and_attrs().nth(attr_id.ast_index())
if let Some((_, Either::Left(attr))) =
collect_attrs(&adt).nth(attr_id.ast_index())
{
res[keys::DERIVE_MACRO_CALL].insert(attr, (attr_id, call_id, calls.into()));
}