Skip to content

Commit 502d57c

Browse files
committed
Deduplicate assoc item cfg handling
1 parent e61403a commit 502d57c

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

Diff for: compiler/rustc_builtin_macros/src/cfg_eval.rs

+3-10
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,11 @@ impl CfgEval<'_> {
121121
let item = parser.parse_item(ForceCollect::Yes)?.unwrap();
122122
Annotatable::Item(self.flat_map_item(item).pop().unwrap())
123123
}
124-
Annotatable::AssocItem(_, AssocCtxt::Trait) => {
124+
Annotatable::AssocItem(_, ctxt) => {
125125
let item = parser.parse_trait_item(ForceCollect::Yes)?.unwrap().unwrap();
126126
Annotatable::AssocItem(
127-
self.flat_map_assoc_item(item, AssocCtxt::Trait).pop().unwrap(),
128-
AssocCtxt::Trait,
129-
)
130-
}
131-
Annotatable::AssocItem(_, AssocCtxt::Impl) => {
132-
let item = parser.parse_impl_item(ForceCollect::Yes)?.unwrap().unwrap();
133-
Annotatable::AssocItem(
134-
self.flat_map_assoc_item(item, AssocCtxt::Impl).pop().unwrap(),
135-
AssocCtxt::Impl,
127+
self.flat_map_assoc_item(item, ctxt).pop().unwrap(),
128+
ctxt,
136129
)
137130
}
138131
Annotatable::ForeignItem(_) => {

0 commit comments

Comments
 (0)