Skip to content

Commit e139d26

Browse files
committed
Introduce some typedefs to improve readability.
1 parent 59372f2 commit e139d26

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ macro_rules! attribute_groups {
2626
(
2727
pub(crate) static $name: ident = [$($names: ty),* $(,)?];
2828
) => {
29-
pub(crate) static $name: LazyLock<(
30-
BTreeMap<&'static [Symbol], Vec<Box<dyn Fn(&AcceptContext<'_>, &ArgParser<'_>) + Send + Sync>>>,
31-
Vec<Box<dyn Send + Sync + Fn(&FinalizeContext<'_>) -> Option<AttributeKind>>>
32-
)> = LazyLock::new(|| {
33-
let mut accepts = BTreeMap::<_, Vec<Box<dyn Fn(&AcceptContext<'_>, &ArgParser<'_>) + Send + Sync>>>::new();
34-
let mut finalizes = Vec::<Box<dyn Send + Sync + Fn(&FinalizeContext<'_>) -> Option<AttributeKind>>>::new();
29+
type Accepts = BTreeMap<
30+
&'static [Symbol],
31+
Vec<Box<dyn Send + Sync + Fn(&AcceptContext<'_>, &ArgParser<'_>)>>
32+
>;
33+
type Finalizes = Vec<
34+
Box<dyn Send + Sync + Fn(&FinalizeContext<'_>) -> Option<AttributeKind>>
35+
>;
36+
pub(crate) static $name: LazyLock<(Accepts, Finalizes)> = LazyLock::new(|| {
37+
let mut accepts = Accepts::new();
38+
let mut finalizes = Finalizes::new();
3539
$(
3640
{
3741
thread_local! {

0 commit comments

Comments
 (0)