Skip to content

Commit 804f0f3

Browse files
Unify spanned and non-spanned Attribute ctors
There is no difference in the code/arguments, so go with the shorter name throughout the code.
1 parent 9152fe4 commit 804f0f3

File tree

4 files changed

+8
-18
lines changed

4 files changed

+8
-18
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_spanned_attr_outer(e.span, attr::mk_attr_id(), allow)
5171+
attr::mk_attr_outer(e.span, attr::mk_attr_id(), allow)
51725172
};
51735173
let attrs = vec![attr];
51745174

src/libsyntax/attr/mod.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -376,37 +376,27 @@ pub fn mk_attr_id() -> AttrId {
376376
AttrId(id)
377377
}
378378

379-
/// Returns an inner attribute with the given value.
380-
pub fn mk_attr_inner(span: Span, id: AttrId, item: MetaItem) -> Attribute {
381-
mk_spanned_attr_inner(span, id, item)
382-
}
383-
384379
/// Returns an inner attribute with the given value and span.
385-
pub fn mk_spanned_attr_inner(sp: Span, id: AttrId, item: MetaItem) -> Attribute {
380+
pub fn mk_attr_inner(span: Span, id: AttrId, item: MetaItem) -> Attribute {
386381
Attribute {
387382
id,
388383
style: ast::AttrStyle::Inner,
389384
path: item.path,
390385
tokens: item.node.tokens(item.span),
391386
is_sugared_doc: false,
392-
span: sp,
387+
span,
393388
}
394389
}
395390

396-
/// Returns an outer attribute with the given value.
397-
pub fn mk_attr_outer(span: Span, id: AttrId, item: MetaItem) -> Attribute {
398-
mk_spanned_attr_outer(span, id, item)
399-
}
400-
401391
/// Returns an outer attribute with the given value and span.
402-
pub fn mk_spanned_attr_outer(sp: Span, id: AttrId, item: MetaItem) -> Attribute {
392+
pub fn mk_attr_outer(span: Span, id: AttrId, item: MetaItem) -> Attribute {
403393
Attribute {
404394
id,
405395
style: ast::AttrStyle::Outer,
406396
path: item.path,
407397
tokens: item.node.tokens(item.span),
408398
is_sugared_doc: false,
409-
span: sp,
399+
span,
410400
}
411401
}
412402

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, sp: Span, mi: ast::MetaItem) -> ast::Attribute {
1138-
attr::mk_spanned_attr_outer(sp, attr::mk_attr_id(), mi)
1138+
attr::mk_attr_outer(sp, attr::mk_attr_id(), mi)
11391139
}
11401140

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

src/libsyntax/ext/expand.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,8 +1341,8 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> {
13411341

13421342
let meta = attr::mk_list_item(DUMMY_SP, Ident::with_empty_ctxt(sym::doc), items);
13431343
match at.style {
1344-
ast::AttrStyle::Inner => *at = attr::mk_spanned_attr_inner(at.span, at.id, meta),
1345-
ast::AttrStyle::Outer => *at = attr::mk_spanned_attr_outer(at.span, at.id, meta),
1344+
ast::AttrStyle::Inner => *at = attr::mk_attr_inner(at.span, at.id, meta),
1345+
ast::AttrStyle::Outer => *at = attr::mk_attr_outer(at.span, at.id, meta),
13461346
}
13471347
} else {
13481348
noop_visit_attribute(at, self)

0 commit comments

Comments
 (0)