1
Fork 0

Add a helper method for extracting spans from AttrArgsEq

This commit is contained in:
Oli Scherer 2024-12-02 10:29:45 +00:00
parent 778321d155
commit c0b532277b
3 changed files with 14 additions and 9 deletions

View file

@ -220,9 +220,9 @@ pub fn attrs_to_doc_fragments<'a>(
fn span_for_value(attr: &ast::Attribute) -> Span {
if let ast::AttrKind::Normal(normal) = &attr.kind
&& let ast::AttrArgs::Eq { value: ast::AttrArgsEq::Hir(meta), .. } = &normal.item.args
&& let ast::AttrArgs::Eq { value, .. } = &normal.item.args
{
meta.span.with_ctxt(attr.span.ctxt())
value.span().with_ctxt(attr.span.ctxt())
} else {
attr.span
}