about summary refs log tree commit diff
path: root/src/libsyntax/attr
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-05-09 02:00:29 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-05-11 14:24:21 +0300
commit28b125b83d9db4094a08b512a956c187bd29a51f (patch)
tree14c5e4dae465b21dcf439c6ed993e9decf6bc23f /src/libsyntax/attr
parentb8e0d0a2aa4f18d76a701150fccb67533f377368 (diff)
downloadrust-28b125b83d9db4094a08b512a956c187bd29a51f.tar.gz
rust-28b125b83d9db4094a08b512a956c187bd29a51f.zip
Turn `ast::Lit` into a struct
Diffstat (limited to 'src/libsyntax/attr')
-rw-r--r--src/libsyntax/attr/mod.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs
index e00f91e3952..e331a263354 100644
--- a/src/libsyntax/attr/mod.rs
+++ b/src/libsyntax/attr/mod.rs
@@ -16,7 +16,7 @@ use crate::ast::{AttrId, Attribute, AttrStyle, Name, Ident, Path, PathSegment};
 use crate::ast::{MetaItem, MetaItemKind, NestedMetaItem};
 use crate::ast::{Lit, LitKind, Expr, ExprKind, Item, Local, Stmt, StmtKind, GenericParam};
 use crate::mut_visit::visit_clobber;
-use crate::source_map::{BytePos, Spanned, respan, dummy_spanned};
+use crate::source_map::{BytePos, Spanned, dummy_spanned};
 use crate::parse::lexer::comments::{doc_comment_style, strip_doc_comment_decoration};
 use crate::parse::parser::Parser;
 use crate::parse::{self, ParseSess, PResult};
@@ -350,11 +350,11 @@ impl Attribute {
 /* Constructors */
 
 pub fn mk_name_value_item_str(ident: Ident, value: Spanned<Symbol>) -> MetaItem {
-    let value = respan(value.span, LitKind::Str(value.node, ast::StrStyle::Cooked));
+    let value = Lit { node: LitKind::Str(value.node, ast::StrStyle::Cooked), span: value.span };
     mk_name_value_item(ident.span.to(value.span), ident, value)
 }
 
-pub fn mk_name_value_item(span: Span, ident: Ident, value: ast::Lit) -> MetaItem {
+pub fn mk_name_value_item(span: Span, ident: Ident, value: Lit) -> MetaItem {
     MetaItem { path: Path::from_ident(ident), span, node: MetaItemKind::NameValue(value) }
 }
 
@@ -417,7 +417,7 @@ pub fn mk_spanned_attr_outer(sp: Span, id: AttrId, item: MetaItem) -> Attribute
 
 pub fn mk_sugared_doc_attr(id: AttrId, text: Symbol, span: Span) -> Attribute {
     let style = doc_comment_style(&text.as_str());
-    let lit = respan(span, LitKind::Str(text, ast::StrStyle::Cooked));
+    let lit = Lit { node: LitKind::Str(text, ast::StrStyle::Cooked), span };
     Attribute {
         id,
         style,
@@ -562,7 +562,7 @@ impl MetaItemKind {
                 tokens.next();
                 return if let Some(TokenTree::Token(span, token)) = tokens.next() {
                     LitKind::from_token(token)
-                        .map(|lit| MetaItemKind::NameValue(Spanned { node: lit, span: span }))
+                        .map(|node| MetaItemKind::NameValue(Lit { node, span }))
                 } else {
                     None
                 };
@@ -609,7 +609,7 @@ impl NestedMetaItem {
         if let Some(TokenTree::Token(span, token)) = tokens.peek().cloned() {
             if let Some(node) = LitKind::from_token(token) {
                 tokens.next();
-                return Some(NestedMetaItem::Literal(respan(span, node)));
+                return Some(NestedMetaItem::Literal(Lit { node, span }));
             }
         }