NoArgsAttributeParser: use an assoc const instead

This commit is contained in:
Pavel Grigorenko
2025-07-02 00:20:47 +03:00
parent 187babc35f
commit 8bb7fdb236
6 changed files with 11 additions and 38 deletions

View File

@@ -238,7 +238,7 @@ pub(crate) trait NoArgsAttributeParser<S: Stage>: 'static {
const ON_DUPLICATE: OnDuplicate<S>;
/// Create the [`AttributeKind`] given attribute's [`Span`].
fn create(span: Span) -> AttributeKind;
const CREATE: fn(Span) -> AttributeKind;
}
pub(crate) struct WithoutArgs<T: NoArgsAttributeParser<S>, S: Stage>(PhantomData<(S, T)>);
@@ -259,7 +259,7 @@ impl<T: NoArgsAttributeParser<S>, S: Stage> SingleAttributeParser<S> for Without
if let Err(span) = args.no_args() {
cx.expected_no_args(span);
}
Some(T::create(cx.attr_span))
Some(T::CREATE(cx.attr_span))
}
}