Skip to content

Commit f78bf50

Browse files
Remove span argument from mk_attr_{inner,outer}
Always the same as the passed MetaItem
1 parent b2c5065 commit f78bf50

File tree

6 files changed

+9
-11
lines changed

6 files changed

+9
-11
lines changed

src/librustc/hir/lowering.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5168,7 +5168,7 @@ impl<'a> LoweringContext<'a> {
51685168
let uc_nested = attr::mk_nested_word_item(uc_ident);
51695169
attr::mk_list_item(e.span, allow_ident, vec![uc_nested])
51705170
};
5171-
attr::mk_attr_outer(e.span, allow)
5171+
attr::mk_attr_outer(allow)
51725172
};
51735173
let attrs = vec![attr];
51745174

src/libsyntax/attr/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,26 +379,26 @@ pub fn mk_attr_id() -> AttrId {
379379
}
380380

381381
/// Returns an inner attribute with the given value and span.
382-
pub fn mk_attr_inner(span: Span, item: MetaItem) -> Attribute {
382+
pub fn mk_attr_inner(item: MetaItem) -> Attribute {
383383
Attribute {
384384
id: mk_attr_id(),
385385
style: ast::AttrStyle::Inner,
386386
path: item.path,
387387
tokens: item.node.tokens(item.span),
388388
is_sugared_doc: false,
389-
span,
389+
span: item.span,
390390
}
391391
}
392392

393393
/// Returns an outer attribute with the given value and span.
394-
pub fn mk_attr_outer(span: Span, item: MetaItem) -> Attribute {
394+
pub fn mk_attr_outer(item: MetaItem) -> Attribute {
395395
Attribute {
396396
id: mk_attr_id(),
397397
style: ast::AttrStyle::Outer,
398398
path: item.path,
399399
tokens: item.node.tokens(item.span),
400400
is_sugared_doc: false,
401-
span,
401+
span: item.span,
402402
}
403403
}
404404

src/libsyntax/ext/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
11351135
}
11361136

11371137
fn attribute(&self, mi: ast::MetaItem) -> ast::Attribute {
1138-
attr::mk_attr_outer(mi.span, mi)
1138+
attr::mk_attr_outer(mi)
11391139
}
11401140

11411141
fn meta_word(&self, sp: Span, w: ast::Name) -> ast::MetaItem {

src/libsyntax/print/pprust.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,12 @@ pub fn print_crate<'a>(cm: &'a SourceMap,
123123
let pi_nested = attr::mk_nested_word_item(ast::Ident::with_empty_ctxt(sym::prelude_import));
124124
let list = attr::mk_list_item(
125125
DUMMY_SP, ast::Ident::with_empty_ctxt(sym::feature), vec![pi_nested]);
126-
let fake_attr = attr::mk_attr_inner(DUMMY_SP, list);
126+
let fake_attr = attr::mk_attr_inner(list);
127127
s.print_attribute(&fake_attr);
128128

129129
// #![no_std]
130130
let no_std_meta = attr::mk_word_item(ast::Ident::with_empty_ctxt(sym::no_std));
131-
let fake_attr = attr::mk_attr_inner(DUMMY_SP, no_std_meta);
131+
let fake_attr = attr::mk_attr_inner(no_std_meta);
132132
s.print_attribute(&fake_attr);
133133
}
134134

src/libsyntax_ext/standard_library_imports.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ pub fn inject(
4141
};
4242
krate.module.items.insert(0, P(ast::Item {
4343
attrs: vec![attr::mk_attr_outer(
44-
DUMMY_SP,
4544
attr::mk_word_item(ast::Ident::with_empty_ctxt(sym::macro_use))
4645
)],
4746
vis: dummy_spanned(ast::VisibilityKind::Inherited),

src/libsyntax_ext/test_harness.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ impl MutVisitor for EntryPointCleaner {
160160
let dc_nested = attr::mk_nested_word_item(Ident::from_str("dead_code"));
161161
let allow_dead_code_item = attr::mk_list_item(DUMMY_SP, allow_ident,
162162
vec![dc_nested]);
163-
let allow_dead_code = attr::mk_attr_outer(DUMMY_SP,
164-
allow_dead_code_item);
163+
let allow_dead_code = attr::mk_attr_outer(allow_dead_code_item);
165164

166165
ast::Item {
167166
id,

0 commit comments

Comments
 (0)