Drop explicit span argument from mk_name_value_item

This commit is contained in:
Mark Rousskov 2019-08-04 18:03:34 -04:00
parent ab3fb1e775
commit 24a491f40c
3 changed files with 4 additions and 5 deletions

View File

@ -211,7 +211,6 @@ fn test_parse_ok() {
fn test_parse_err() {
with_default_globals(|| {
let mi = attr::mk_name_value_item(
DUMMY_SP,
Ident::from_str("foo"),
LitKind::Bool(false),
DUMMY_SP,

View File

@ -347,11 +347,12 @@ impl Attribute {
pub fn mk_name_value_item_str(ident: Ident, value: Spanned<Symbol>) -> MetaItem {
let lit_kind = LitKind::Str(value.node, ast::StrStyle::Cooked);
mk_name_value_item(ident.span.to(value.span), ident, lit_kind, value.span)
mk_name_value_item(ident, lit_kind, value.span)
}
pub fn mk_name_value_item(span: Span, ident: Ident, lit_kind: LitKind, lit_span: Span) -> MetaItem {
pub fn mk_name_value_item(ident: Ident, lit_kind: LitKind, lit_span: Span) -> MetaItem {
let lit = Lit::from_lit_kind(lit_kind, lit_span);
let span = ident.span.to(lit_span);
MetaItem { path: Path::from_ident(ident), span, node: MetaItemKind::NameValue(lit) }
}

View File

@ -884,8 +884,7 @@ impl<'a> ExtCtxt<'a> {
pub fn meta_name_value(&self, span: Span, name: ast::Name, lit_kind: ast::LitKind)
-> ast::MetaItem {
attr::mk_name_value_item(span, Ident::new(name, span),
lit_kind, span)
attr::mk_name_value_item(Ident::new(name, span), lit_kind, span)
}
pub fn item_use(&self, sp: Span,