mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
Fix cfg_attr invalidating derive identifier IDE functionality
This commit is contained in:
parent
cc04cfc982
commit
ddf7b70a0f
3 changed files with 14 additions and 15 deletions
|
@ -73,8 +73,8 @@ impl ops::Deref for RawAttrs {
|
|||
}
|
||||
}
|
||||
impl Attrs {
|
||||
pub fn get(&self, AttrId { ast_index, .. }: AttrId) -> Option<&Attr> {
|
||||
(**self).get(ast_index as usize)
|
||||
pub fn get(&self, id: AttrId) -> Option<&Attr> {
|
||||
(**self).iter().find(|attr| attr.id == id)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,14 +89,6 @@ impl ops::Deref for Attrs {
|
|||
}
|
||||
}
|
||||
|
||||
impl ops::Index<AttrId> for Attrs {
|
||||
type Output = Attr;
|
||||
|
||||
fn index(&self, AttrId { ast_index, .. }: AttrId) -> &Self::Output {
|
||||
&(**self)[ast_index as usize]
|
||||
}
|
||||
}
|
||||
|
||||
impl ops::Deref for AttrsWithOwner {
|
||||
type Target = Attrs;
|
||||
|
||||
|
@ -110,7 +102,7 @@ impl RawAttrs {
|
|||
|
||||
pub(crate) fn new(db: &dyn DefDatabase, owner: &dyn ast::HasAttrs, hygiene: &Hygiene) -> Self {
|
||||
let entries = collect_attrs(owner)
|
||||
.flat_map(|(id, attr)| match attr {
|
||||
.filter_map(|(id, attr)| match attr {
|
||||
Either::Left(attr) => {
|
||||
attr.meta().and_then(|meta| Attr::from_src(db, meta, hygiene, id))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue