diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-11-14 12:00:25 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-11-20 11:46:00 +0000 |
| commit | 3ea2bc4e935e273268f3f6d8de45a27042dc5e48 (patch) | |
| tree | 4def39226f97e50bebf099a93857735bc3c77bb1 /src/libsyntax/parse | |
| parent | bfa709a38a8c607e1c13ee5635fbfd1940eb18b1 (diff) | |
| download | rust-3ea2bc4e935e273268f3f6d8de45a27042dc5e48.tar.gz rust-3ea2bc4e935e273268f3f6d8de45a27042dc5e48.zip | |
Refactor away `ast::Attribute_`.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 20 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 4 |
2 files changed, 10 insertions, 14 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index 983c882eafc..8818b94209e 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -11,7 +11,7 @@ use attr; use ast; use syntax_pos::{mk_sp, Span}; -use codemap::{spanned, Spanned}; +use codemap::spanned; use parse::common::SeqSep; use parse::PResult; use parse::token; @@ -55,7 +55,7 @@ impl<'a> Parser<'a> { self.span.lo, self.span.hi ); - if attr.node.style != ast::AttrStyle::Outer { + if attr.style != ast::AttrStyle::Outer { let mut err = self.fatal("expected outer doc comment"); err.note("inner doc comments like this (starting with \ `//!` or `/*!`) can only appear before items"); @@ -145,14 +145,12 @@ impl<'a> Parser<'a> { style = ast::AttrStyle::Inner; } - Ok(Spanned { + Ok(ast::Attribute { + id: attr::mk_attr_id(), + style: style, + value: value, + is_sugared_doc: false, span: span, - node: ast::Attribute_ { - id: attr::mk_attr_id(), - style: style, - value: value, - is_sugared_doc: false, - }, }) } @@ -172,7 +170,7 @@ impl<'a> Parser<'a> { } let attr = self.parse_attribute(true)?; - assert!(attr.node.style == ast::AttrStyle::Inner); + assert!(attr.style == ast::AttrStyle::Inner); attrs.push(attr); } token::DocComment(s) => { @@ -180,7 +178,7 @@ impl<'a> Parser<'a> { let Span { lo, hi, .. } = self.span; let str = self.id_to_interned_str(ast::Ident::with_empty_ctxt(s)); let attr = attr::mk_sugared_doc_attr(attr::mk_attr_id(), str, lo, hi); - if attr.node.style == ast::AttrStyle::Inner { + if attr.style == ast::AttrStyle::Inner { attrs.push(attr); self.bump(); } else { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 2e38ca82d5d..98ce00c7d38 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -3751,9 +3751,7 @@ impl<'a> Parser<'a> { /// Emit an expected item after attributes error. fn expected_item_err(&self, attrs: &[Attribute]) { let message = match attrs.last() { - Some(&Attribute { node: ast::Attribute_ { is_sugared_doc: true, .. }, .. }) => { - "expected item after doc comment" - } + Some(&Attribute { is_sugared_doc: true, .. }) => "expected item after doc comment", _ => "expected item after attributes", }; |
