Unify spanned and non-spanned Attribute ctors
There is no difference in the code/arguments, so go with the shorter name throughout the code.
This commit is contained in:
@@ -5168,7 +5168,7 @@ impl<'a> LoweringContext<'a> {
|
||||
let uc_nested = attr::mk_nested_word_item(uc_ident);
|
||||
attr::mk_list_item(e.span, allow_ident, vec![uc_nested])
|
||||
};
|
||||
attr::mk_spanned_attr_outer(e.span, attr::mk_attr_id(), allow)
|
||||
attr::mk_attr_outer(e.span, attr::mk_attr_id(), allow)
|
||||
};
|
||||
let attrs = vec![attr];
|
||||
|
||||
|
||||
@@ -376,37 +376,27 @@ pub fn mk_attr_id() -> AttrId {
|
||||
AttrId(id)
|
||||
}
|
||||
|
||||
/// Returns an inner attribute with the given value.
|
||||
pub fn mk_attr_inner(span: Span, id: AttrId, item: MetaItem) -> Attribute {
|
||||
mk_spanned_attr_inner(span, id, item)
|
||||
}
|
||||
|
||||
/// Returns an inner attribute with the given value and span.
|
||||
pub fn mk_spanned_attr_inner(sp: Span, id: AttrId, item: MetaItem) -> Attribute {
|
||||
pub fn mk_attr_inner(span: Span, id: AttrId, item: MetaItem) -> Attribute {
|
||||
Attribute {
|
||||
id,
|
||||
style: ast::AttrStyle::Inner,
|
||||
path: item.path,
|
||||
tokens: item.node.tokens(item.span),
|
||||
is_sugared_doc: false,
|
||||
span: sp,
|
||||
span,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns an outer attribute with the given value.
|
||||
pub fn mk_attr_outer(span: Span, id: AttrId, item: MetaItem) -> Attribute {
|
||||
mk_spanned_attr_outer(span, id, item)
|
||||
}
|
||||
|
||||
/// Returns an outer attribute with the given value and span.
|
||||
pub fn mk_spanned_attr_outer(sp: Span, id: AttrId, item: MetaItem) -> Attribute {
|
||||
pub fn mk_attr_outer(span: Span, id: AttrId, item: MetaItem) -> Attribute {
|
||||
Attribute {
|
||||
id,
|
||||
style: ast::AttrStyle::Outer,
|
||||
path: item.path,
|
||||
tokens: item.node.tokens(item.span),
|
||||
is_sugared_doc: false,
|
||||
span: sp,
|
||||
span,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1135,7 +1135,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
|
||||
}
|
||||
|
||||
fn attribute(&self, sp: Span, mi: ast::MetaItem) -> ast::Attribute {
|
||||
attr::mk_spanned_attr_outer(sp, attr::mk_attr_id(), mi)
|
||||
attr::mk_attr_outer(sp, attr::mk_attr_id(), mi)
|
||||
}
|
||||
|
||||
fn meta_word(&self, sp: Span, w: ast::Name) -> ast::MetaItem {
|
||||
|
||||
@@ -1341,8 +1341,8 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
|
||||
|
||||
let meta = attr::mk_list_item(DUMMY_SP, Ident::with_empty_ctxt(sym::doc), items);
|
||||
match at.style {
|
||||
ast::AttrStyle::Inner => *at = attr::mk_spanned_attr_inner(at.span, at.id, meta),
|
||||
ast::AttrStyle::Outer => *at = attr::mk_spanned_attr_outer(at.span, at.id, meta),
|
||||
ast::AttrStyle::Inner => *at = attr::mk_attr_inner(at.span, at.id, meta),
|
||||
ast::AttrStyle::Outer => *at = attr::mk_attr_outer(at.span, at.id, meta),
|
||||
}
|
||||
} else {
|
||||
noop_visit_attribute(at, self)
|
||||
|
||||
Reference in New Issue
Block a user