@@ -32,6 +32,7 @@ use crate::{
3232 VariantId,
3333};
3434
35+ /// Desugared attributes of an item post `cfg_attr` expansion.
3536#[derive(Default, Debug, Clone, PartialEq, Eq)]
3637pub struct Attrs(RawAttrs);
3738
@@ -228,7 +229,6 @@ pub enum DocAtom {
228229 KeyValue { key: SmolStr, value: SmolStr },
229230}
230231
231- // Adapted from `CfgExpr` parsing code
232232#[derive(Debug, Clone, PartialEq, Eq, Hash)]
233233pub enum DocExpr {
234234 Invalid,
@@ -448,10 +448,7 @@ impl AttrsWithOwner {
448448 let map = db.fields_attrs_source_map(id.parent);
449449 let file_id = id.parent.file_id(db);
450450 let root = db.parse_or_expand(file_id);
451- let owner = match &map[id.local_id] {
452- Either::Left(it) => ast::AnyHasAttrs::new(it.to_node(&root)),
453- Either::Right(it) => ast::AnyHasAttrs::new(it.to_node(&root)),
454- };
451+ let owner = ast::AnyHasAttrs::new(map[id.local_id].to_node(&root));
455452 InFile::new(file_id, owner)
456453 }
457454 AttrDefId::AdtId(adt) => match adt {
@@ -634,7 +631,7 @@ fn attrs_from_item_tree_assoc<'db, N: ItemTreeModItemNode>(
634631pub(crate) fn fields_attrs_source_map(
635632 db: &dyn DefDatabase,
636633 def: VariantId,
637- ) -> Arc<ArenaMap<LocalFieldId, Either< AstPtr<ast::TupleField>, AstPtr< ast::RecordField>>>> {
634+ ) -> Arc<ArenaMap<LocalFieldId, AstPtr<Either< ast::TupleField, ast::RecordField>>>> {
638635 let mut res = ArenaMap::default();
639636 let child_source = def.child_source(db);
640637
@@ -643,7 +640,7 @@ pub(crate) fn fields_attrs_source_map(
643640 idx,
644641 variant
645642 .as_ref()
646- .either(|l| Either::Left( AstPtr::new(l)), |r| Either::Right( AstPtr::new(r))),
643+ .either(|l| AstPtr::new(l).wrap_left( ), |r| AstPtr::new(r).wrap_right( )),
647644 );
648645 }
649646
0 commit comments