1
Fork 0

Remove span argument from mk_attr_{inner,outer}

Always the same as the passed MetaItem
This commit is contained in:
Mark Rousskov 2019-07-30 14:18:19 -04:00
parent b2c5065b04
commit f78bf50dec
6 changed files with 9 additions and 11 deletions

View file

@ -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_attr_outer(e.span, allow)
attr::mk_attr_outer(allow)
};
let attrs = vec![attr];

View file

@ -379,26 +379,26 @@ pub fn mk_attr_id() -> AttrId {
}
/// Returns an inner attribute with the given value and span.
pub fn mk_attr_inner(span: Span, item: MetaItem) -> Attribute {
pub fn mk_attr_inner(item: MetaItem) -> Attribute {
Attribute {
id: mk_attr_id(),
style: ast::AttrStyle::Inner,
path: item.path,
tokens: item.node.tokens(item.span),
is_sugared_doc: false,
span,
span: item.span,
}
}
/// Returns an outer attribute with the given value and span.
pub fn mk_attr_outer(span: Span, item: MetaItem) -> Attribute {
pub fn mk_attr_outer(item: MetaItem) -> Attribute {
Attribute {
id: mk_attr_id(),
style: ast::AttrStyle::Outer,
path: item.path,
tokens: item.node.tokens(item.span),
is_sugared_doc: false,
span,
span: item.span,
}
}

View file

@ -1135,7 +1135,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
}
fn attribute(&self, mi: ast::MetaItem) -> ast::Attribute {
attr::mk_attr_outer(mi.span, mi)
attr::mk_attr_outer(mi)
}
fn meta_word(&self, sp: Span, w: ast::Name) -> ast::MetaItem {

View file

@ -123,12 +123,12 @@ pub fn print_crate<'a>(cm: &'a SourceMap,
let pi_nested = attr::mk_nested_word_item(ast::Ident::with_empty_ctxt(sym::prelude_import));
let list = attr::mk_list_item(
DUMMY_SP, ast::Ident::with_empty_ctxt(sym::feature), vec![pi_nested]);
let fake_attr = attr::mk_attr_inner(DUMMY_SP, list);
let fake_attr = attr::mk_attr_inner(list);
s.print_attribute(&fake_attr);
// #![no_std]
let no_std_meta = attr::mk_word_item(ast::Ident::with_empty_ctxt(sym::no_std));
let fake_attr = attr::mk_attr_inner(DUMMY_SP, no_std_meta);
let fake_attr = attr::mk_attr_inner(no_std_meta);
s.print_attribute(&fake_attr);
}

View file

@ -41,7 +41,6 @@ pub fn inject(
};
krate.module.items.insert(0, P(ast::Item {
attrs: vec![attr::mk_attr_outer(
DUMMY_SP,
attr::mk_word_item(ast::Ident::with_empty_ctxt(sym::macro_use))
)],
vis: dummy_spanned(ast::VisibilityKind::Inherited),

View file

@ -160,8 +160,7 @@ impl MutVisitor for EntryPointCleaner {
let dc_nested = attr::mk_nested_word_item(Ident::from_str("dead_code"));
let allow_dead_code_item = attr::mk_list_item(DUMMY_SP, allow_ident,
vec![dc_nested]);
let allow_dead_code = attr::mk_attr_outer(DUMMY_SP,
allow_dead_code_item);
let allow_dead_code = attr::mk_attr_outer(allow_dead_code_item);
ast::Item {
id,